Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Thanked 1 Time in 1 Post

    VBA code in excel to go up at range (excel xp)

    lngRow = activesheet.Cells(65536, 2).End(xlUp).Row
    Set rng2search = Range("B6:B" & lngRow)

    For Each c In rng2search

    I need to make the For statement start at the end of the range and work it's way up a row at a time. I don't know how to program it that way? Please help. Thank you

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: VBA code in excel to go up at range (excel xp)

    I already posted code for that does something EXACTLY like that yesterday, in <post#=400735>post 400735</post#>. It is a good idea to study the code provided, not just use it.

    Dim lngRow As Long
    Dim c As Range

    For lngRow = Activesheet.Cells(65536, 2).End(xlUp).Row To 6 Step -1
    Set c = ActiveSheet.Cells(lngRow, 2)
    ' Code to process c goes here
    Next lngRow

    The "Step -1" causes the loop to move backwards from the last row to the first one.

Posting Permissions

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