Thread: Leave loop
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Leave loop

If I understand your question correctly, execute an

Exit For

statement right after your Past statement.

--
Rick (MVP - Excel)


wrote in message
...
so I have this part of the loop doing what I want.
For i = 3 To 100
Worksheets("Shapes").Range("I5:I7").Copy
If IsEmpty(Worksheets("MAG").Cells(i - 1, 1)) Then
Worksheets("MAG").Cells(i - 1, 1).PasteSpecial Paste:=xlPasteValues,
Transpose:=True

Next

However, I want it to stop right after it pastes and leave the for
loop. So basically it reads the page where ever the next blank row is
it pastes then stops. thanks