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: 66
Default Loop in a loop syntax

I'm trying to loop through all worksheets in the active workbook, then loop
through each row in the worksheet and delete all rows with zero in column AA.
I'm having trouble with syntax - here's what I've got:

Sub DeleteRowsTest()

Dim w As Worksheet
Dim FirstRow, LastRow, CurRow As Integer
Dim col As String

FirstRow = 5
LastRow = 20000
col = "AA"

For Each w In Worksheets
For CurRow = LastRow To FirstRow Step -1
If w.Cells(CurRow, col) = 0 Then
w.Rows(CurRow).Delete
Next CurRow
Exit For
Next

End Sub

Help!!!!
 
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
Syntax for stopping a Do Loop? bondjel Excel Discussion (Misc queries) 5 March 22nd 10 01:35 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
VBA Loop Case..If syntax okelly[_5_] Excel Programming 5 August 7th 06 03:24 PM
loop syntax Knox Excel Programming 2 May 17th 06 06:57 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 11:50 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"