Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA loops
Excel VBA loops
Resolved · Low Priority · Version 2003
Excel VBA loops
How do I write a loop to calculate a result for each row in a spreadsheet?For upcoming training course dates see: Pricing & availability
RE: Excel VBA loops
Hi MaikThank you for your question.
To work through rows of data in a loop I recommend you use the For Each loop
Example
Dim rngRow as Range
Dim rngData as Range
Set rngData=Range("A2:E44") ' Change to the correct area
For Each rngRow in rngData.Rows
'insert code to manipulate or enquire upon each row
'eg rngRow.cells(1).Interior.Color = vbRed
Next rngRow
Please let me know how you get on.
Laura GB
Wed 28 Jan 2009: Automatically marked as resolved.
|
|
» Forum post: Marquee tag |



Course updates

