+ Reply to Thread
Results 1 to 3 of 3

Extend Loop From Within ?

Hybrid View

Blewyn Extend Loop From Within ? 02-26-2007, 12:52 AM
mudraker As far as I know you can not... 02-26-2007, 01:45 AM
Blewyn DOH ! <bangs head against... 02-26-2007, 05:34 AM
  1. #1
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    As far as I know you can not alter the End loop number once you are inside the for loop

    You could use a do - loop or use a For loop stepping backwards

    This is how I would do it
    Sub ffff()
    Dim iLoop As Integer
    Dim iEndOfLoop As Integer
    
    iEndOfLoop = Cells(Rows.Count, "a").End(xlUp).Row
    For iLoop = iEndOfLoop To 1 Step -1
    If Cells(iLoop, 1) = 1 Then
    Rows(iLoop + 1).Insert Shift:=xlDown
    End If
    Next iLoop
    End Sub

  2. #2
    Registered User
    Join Date
    11-18-2003
    Posts
    33

    Talking

    Quote Originally Posted by mudraker
    You could use a do - loop or use a For loop stepping backwards
    DOH ! <bangs head against desk in vain hope of restarting brain>

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1