Help With Loop

D

Dennis

Using this macro....

Sub Finale()
Range("B2:B11").Select
Application.Run "Move2help"
Application.Run "Drop3"
Application.Run "MoveTotal7"
Application.Run "Clean"
End Sub

What I'm trying to get to work is after the Clean macro runs I want to Loop
back to the beginning and instead of Range("B2:B11").Select I want to Select
the same Row range but one column to the right, so Range("C2:C11").Select.
Then I would like it to keep looping while incrementing up one Column each
Loop but keeping the same row range (2:11). I would like the Loop to stop when
it gets to a Column where there is no Data, So if there was data in L2:L11 but
none in M2:M11 the Macro will quit when it hits M.

TIA, Dennis
===================
 
N

Nick Hodge

Denis

This should work

Sub Finale()
Dim iLastCol As Integer, x As Integer
iLastCol = Range("IV2").End(xlToLeft).Column
For x = 2 To iLastCol
Range(Cells(2, x), Cells(11, x)).Select
'your routines here
Next x
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
D

Dennis

Very nice Nick! Works great!! I wasn't even close. Thanx so much for the help.

Dennis
============
 

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