Greetings,
I have a macro that works great between worksheets within the same workbook, but I need this to work between different workbooks.
Excel 2003
Each of three employees (ABC, DEF & GHI) has their own workbook to track projects: ABC Workbook.xls, DEF Workbook.xls, and GHI Workbook.xls
All data is located on the sheet named CAT1 in each workbook
Column E is where the name is located, thus assigning them to that project
To "reassign" a project to a different employee - I change the name in column E then run the macro, which needs to do the following:
1) find any rows with a specific employee's name in one workbook
2) copy the data in that from from column A to V
3) OPEN the correct employee's password protected workbook (protected from opening)
4) Go to the CAT1 sheet and unprotect the sheet (no password)
5) Paste all data except for column S
6) Protect the sheet, save & close the workbook
7) Delete the row that was copied from the original workbook
EXAMPLE
Say I'm working in employee ABC's workbook (ABC Workbook.xls),on the sheet labeled CAT1
I'll have two macros, one for reassigning projects to DEF and another for reassigning to GHI (unless they can somehow be done within the same macro)
Lets say I reassign the project in row 10 to employee DEF, by changing data in column E from ABC to DEF & then run the DEF re-assign macro ...
1) finds DEF in column e / row 10
2) copies data in row 10, from column A to V
3) opens DEF Workbook.xls (password ef)
4) goes to CAT1 sheet, and unprotects sheet (no password)
5) Pastes all data on next available row - excluding column S
5) Protect CAT1 sheet, save and close DEF Workbook.xls
6) delete row 10 from ABC Workbook.xls (this workbook remains open)
Below is the code I have that works from sheet to sheet in the same workbook. If someone can help me modify it to do the above, I'd be so thankful!
I have a macro that works great between worksheets within the same workbook, but I need this to work between different workbooks.
Excel 2003
Each of three employees (ABC, DEF & GHI) has their own workbook to track projects: ABC Workbook.xls, DEF Workbook.xls, and GHI Workbook.xls
All data is located on the sheet named CAT1 in each workbook
Column E is where the name is located, thus assigning them to that project
To "reassign" a project to a different employee - I change the name in column E then run the macro, which needs to do the following:
1) find any rows with a specific employee's name in one workbook
2) copy the data in that from from column A to V
3) OPEN the correct employee's password protected workbook (protected from opening)
4) Go to the CAT1 sheet and unprotect the sheet (no password)
5) Paste all data except for column S
6) Protect the sheet, save & close the workbook
7) Delete the row that was copied from the original workbook
EXAMPLE
Say I'm working in employee ABC's workbook (ABC Workbook.xls),on the sheet labeled CAT1
I'll have two macros, one for reassigning projects to DEF and another for reassigning to GHI (unless they can somehow be done within the same macro)
Lets say I reassign the project in row 10 to employee DEF, by changing data in column E from ABC to DEF & then run the DEF re-assign macro ...
1) finds DEF in column e / row 10
2) copies data in row 10, from column A to V
3) opens DEF Workbook.xls (password ef)
4) goes to CAT1 sheet, and unprotects sheet (no password)
5) Pastes all data on next available row - excluding column S
5) Protect CAT1 sheet, save and close DEF Workbook.xls
6) delete row 10 from ABC Workbook.xls (this workbook remains open)
Below is the code I have that works from sheet to sheet in the same workbook. If someone can help me modify it to do the above, I'd be so thankful!
Code:
Option Explicit
Sub copy_ABCtoDEF()
Dim lrow As Long, i As Long
With Worksheets("CAT1")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = lrow To 3 Step -1
If .Range("E" & i).Value = "DEF" Then
.Range("A" & i & ":V" & i).Copy Worksheets("CAT1 DEF").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
.Rows(i).Delete
lrow = lrow - 1
End If
Next i
End With
End Sub