LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stepping Through Rows


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stepping in to a cell Max Excel Discussion (Misc queries) 3 April 27th 10 02:44 AM
Stepping Problem, ben Excel Programming 3 February 8th 06 04:17 PM
Stepping through For Each...Next backwards? Mike Lee[_2_] Excel Programming 5 June 6th 04 07:42 PM
stepping down rows JasonMeyer Excel Programming 5 February 23rd 04 08:02 PM
Stepping through a column using FOR/NEXT Joe Mathis Excel Programming 1 December 3rd 03 06:36 AM


All times are GMT +1. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"