Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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. -- DavidW ------------------------------------------------------------------------ DavidW's Profile: http://www.excelforum.com/member.php...o&userid=32630 View this thread: http://www.excelforum.com/showthread...hreadid=574343 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Stepping in to a cell | Excel Discussion (Misc queries) | |||
Stepping Problem, | Excel Programming | |||
Stepping through For Each...Next backwards? | Excel Programming | |||
stepping down rows | Excel Programming | |||
Stepping through a column using FOR/NEXT | Excel Programming |