Greetings - I posted this thread ... lots of people looked, but it got no replies. I think I may have made it sound to complicated, so I wanted to give this another go.
I have a macro that works, that does this:
1) Finds rows on sheet CAT1 with "DEF" in column E
2) Copies data in those rows from column A to V
3) Pastes data to another sheet in the same workbook (CAT1 DEF), on first available row
4) Deletes the rows from sheet CAT1 that were copied/pasted to CAT1 DEF
I need help modifying it to do this :
1) Finds rows on sheet CAT1 with "DEF" in column E
2) Copies data in those rows from column A to V
**this is where it I need help**
3) opens DEF Workbook.xls (password protected. Password is: ef)
4) unprotects sheet CAT1 of DEF Workbook.xls(no password)
5) Pastes all data on next available row - excluding column S
6) Protect CAT1 sheet, save and close DEF Workbook.xls
**end help**
7) delete rows copied from original workbook/sheet CAT1 (original workbook stays open)
Here is the code I have:
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
Bookmarks