Step down a list

G

Guest

Hi All..........
I have a list that starts in B5 and extends downward for I don't know how
many rows. I would like to select B5 and run MyCoolMacro, then step down to
B6 and run MyCoolMacro again, etc etc as far down as there are cells in
column B with values in them..........help please

Vaya con Dios,
Chuck, CABGx3
 
T

Tom Ogilvy

Sub RunMyCool()
Dim rng as Range, cell as Range
With Worksheets("Sheet1")
.Activate
set rng = .Range(.Range("B5"),.Range("B5").End(xldown))
End With
for each cell in rng
cell.Select
MyCoolMacro
Next
End Sub

Assumes your macro works on the activecell.
 
G

Guest

Thanks very much Tom. As usual, your solution does the trick very nicely.

Vaya con Dios,
Chuck, CABGx3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top