Do loop

Joined
Jul 25, 2007
Messages
26
Reaction score
0
To All, I'm trying to get the following code to loop. Can anyone please help. I've tried all sorts of things. I either get no loop or an infinite loop. Thanks Geoffrey Barnard

Sub Sort0s()
Dim MyCounter
MyCounter = 1
Do Until MyCounter = 11
Cells.Find(What:="0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
True, SearchFormat:=False).Activate
ActiveCell.Offset(0, -1).Select
Range(Selection, Selection.End(xlDown)).Select

Selection.sort Key1:=ActiveCell, Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

ActiveCell.Offset(0, 2).Select

MyCounter = MyCounter + 1
Loop

End Sub
 

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

Similar Threads


Top