Newbie- Edit a recorded macro to include Do Loop

Hi everyone! I'm very new to most Excel functions and 1000% new to macros. Please keep this in mind when answering and make things as fool-proof as possible. ;)

I receive an Excel spreadsheet every week which is continously being updated with new data. I perform a few simple calculations, pull out some averages, and put everything on a lovely chart to prove we're doing well as a department. The more data we add, the longer this process takes, the more mistakes happen, and the more I really really want to learn how to create macros. So far, I've created a practice workbook, created a few lines of code with the Record Macro feature, and everything has worked out. However, next week... it won't... b/c I will have more data in my spreadsheet and so my ranges will be off, true?

I read about The Do...Loop function and using the While condition. I think it would be best to tell Excel to Do mymacro While cells in my column do not equal a blank cell.

Do While cells(x,1).value<>""

Is there an easy way to edit the macros I have already recorded and add the Do Loop function?

If so, many many more questions will follow!

:)

Thanks for your help!

Nick's picture

u don't need "Do".. u can

u don't need "Do"..

u can use
while cells(x,1).value<>""
' do something
x=x+1
wend

also look at FOR loops if you can define the end at the start of the loop:

http://www.excelexperts.com/Learn-VBA-FOR-Loops

Hmm, quite an open question

Hmm, quite an open question without much to go on.

You certainly can add do loops to macros and loop over cells that meet certain criteria (i.e. blank, not blank, numeric etc..) but without an example spreadsheet of what you want it's difficult to know where to start. If you could maybe upload something I could take a look and (hopefully) give you guidance on how to achieve what you want.