98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA loops
Excel VBA loops
Resolved · Low Priority · Version 2003
Maik has attended:
Excel VBA Intro Intermediate course
Excel VBA loops
How do I write a loop to calculate a result for each row in a spreadsheet?
RE: Excel VBA loops
Hi Maik
Thank 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.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Screen Splitters in ExcelScreen splitter icons can be set from the ribbon bar, or dragged from the scroll bars. The icon just above the up arrow on the right scroll bar controls the horizontal splitter; the icon to the right of the right arrow on the bottom scroll bar controls the vertical splitter. |