D
DavidW
I am attempting to have a macro copy and then remove certain rows from
worksheet "Master" to worksheet "Complete". The following code snippet
gets the values for the last row and column for each worksheet:
Code:
--------------------
LcMaster = LastColumn(Sheets("Master")) 'last column of Master
LrMaster = LastRow(Sheets("Master")) ' last row of Master
LastCell = Cells(LrMaster, LcMaster).Address ' last cell of Master
Lr = LastRow(Sheets("Complete")) + 1 ' row after the last row of Complete
--------------------
With that information, I need to step through each row in the "Master"
worksheet that has data. I need to check column H for data (a
completion date). If it has data it is moved. The code below works,
except that I would like for it to start on the second row instead of
the first:
Code:
--------------------
For Each rw In Worksheets("Master").Rows
If Len(Cells(rw.Row, "H")) > 0 Then
Set sourceRange = ActiveCell.EntireRow
Set destrange = Sheets("Complete").Rows(Lr + 1)
sourceRange.Copy destrange
sourceRange.EntireRow.Delete
End If
Next rw
--------------------
How can I get the For/Next loop to start at row 2?
Thanks.
worksheet "Master" to worksheet "Complete". The following code snippet
gets the values for the last row and column for each worksheet:
Code:
--------------------
LcMaster = LastColumn(Sheets("Master")) 'last column of Master
LrMaster = LastRow(Sheets("Master")) ' last row of Master
LastCell = Cells(LrMaster, LcMaster).Address ' last cell of Master
Lr = LastRow(Sheets("Complete")) + 1 ' row after the last row of Complete
--------------------
With that information, I need to step through each row in the "Master"
worksheet that has data. I need to check column H for data (a
completion date). If it has data it is moved. The code below works,
except that I would like for it to start on the second row instead of
the first:
Code:
--------------------
For Each rw In Worksheets("Master").Rows
If Len(Cells(rw.Row, "H")) > 0 Then
Set sourceRange = ActiveCell.EntireRow
Set destrange = Sheets("Complete").Rows(Lr + 1)
sourceRange.Copy destrange
sourceRange.EntireRow.Delete
End If
Next rw
--------------------
How can I get the For/Next loop to start at row 2?
Thanks.