hoping someone is able to help me! I've been stuck for some time... Thanks in advance!
In Workbook 1, if column D (starting row 19 and higher) in Sheet1 is equal to "SOW", then copy entire row to first available row (after row 19) in Sheet1 Workbook 2. Once copied continue scanning through items in column D for more instances of "SOW".
Background - I am attempting to copy entire row as I have to copy the row from row A:NL - There are around 175 rows which it needs to go though
Below are two codes that I have tried to no avail. They essentially do nothing, there are no errors.
Sub TEST2()
Dim LastRow As Long, i As Long, erow As Long
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Cells(i, 4).Value = "SOW" Then
Range(Cells(i, 1), Cells(i, 400)).Select.Copy
Workbooks.Open Filename:="Y:\Station Operations\Station Ops Shared\WEST VACATION CALENDAR 2019.xlsm"
Worksheets("SOW_2019").Select
erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.CutCopyMode = False
End If
Next i
End Sub
Sub TESTER()
Dim i As Long
Dim outRow As Long
Dim sourceWs As Worksheet, destWs As Worksheet
Set sourceWs = Workbooks("EAST VACATION CALENDAR 2019").Worksheets("SOE_2019")
Set destWs = Workbooks("WEST VACATION CALENDAR 2019").Worksheets("SOW_2019")
LastRow = ActiveSheet.Range(“A” & Rows.Count).End(xlUp).Row
outRow = 1
For i = 19 To LastRow
If sourceWs.Cells(i, 4).Value = "SOW" Then
sourceWs.Rows(i).EntireRow.Copy destWs.Rows(outRow)
outRow = outRow + 1
Application.CutCopyMode = False
End If
Next i
End Sub