View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
SteveF[_2_] SteveF[_2_] is offline
external usenet poster
 
Posts: 2
Default Limit the Loop to 500 Rows

Here is the code - It still goes to the bottom of the sheet and keeps
trying to run. What have I done wrong. Thanks
Steve
Dim c As Range
Set c = Range("A1")

Range("C1").Select
Selection.End(xlDown).Select
Do Until c.Row 500
Selection.Insert Shift:=xlToRight
Selection.End(xlDown).Select
Loop
MsgBox ("Finished!")

On Sat, 25 Jun 2005 22:35:17 -0400, "Vasant Nanavati" <vasantn AT aol
DOT com wrote:

If you post the relevant code it would be helpful. But in general:

Dim c As Range
Set c = Range("A1")
Do Until c.Row 500
Debug.Print c.Row
Set c = c.Offset(1)
Loop