+ Reply to Thread
Results 1 to 3 of 3

Is it possible to use a For Each loop starting at the bottom of a range

Hybrid View

Excel_vba Is it possible to use a For... 12-18-2013, 08:07 PM
David A Coop Re: Is it possible to use a... 12-18-2013, 08:17 PM
TMS Re: Is it possible to use a... 12-18-2013, 08:18 PM
  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Is it possible to use a For Each loop starting at the bottom of a range

    I can't figure out how to do this.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Is it possible to use a For Each loop starting at the bottom of a range

    Yes

    Try For Each r in lastcell to 1 Step -1

    As the first line in your loop.


    Please remember, your request is clearer if you attach a sample workbook.
    - Click on Go Advanced and click on the Paper Clip.
    When you reply please make it clear WHO you are responding to by mentioning their name.
    If we have been of assistance, please let us know. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.
    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,557

    Re: Is it possible to use a For Each loop starting at the bottom of a range

    You mean, like:
    For Each cell in Range("A1:A20")
    No

    you'd need to say:

    Dim i As Long
    For i = 20 To 1 Step -1
        Range("A" & i).Value = i
    Next 'i


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Loop that adds thick bottom border to row range
    By msmick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2012, 11:43 PM
  2. [SOLVED] Loop a range from bottom up
    By Who I Am in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2006, 02:55 PM
  3. starting from bottom of range instead of top
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2006, 03:50 PM
  4. Scroll bar starting at bottom of form
    By Adamaths in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2006, 05:24 AM
  5. Scrollbars starting at the bottom of form
    By cparsons in forum Excel General
    Replies: 0
    Last Post: 07-30-2005, 08:54 PM

Tags for this Thread

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