+ Reply to Thread
Results 1 to 3 of 3

Loop till last row

  1. #1
    Registered User
    Join Date
    06-16-2013
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    8

    Loop till last row

    I have a macro that loops For i = 2 To 17, where row 17 is the last row of data.

    Dim i as Integer
    For i = 2 To 17
    Do something
    Next i

    However, my last row of data changes everyday. How can I modify the macro such that I can loop it until the last row?

  2. #2
    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,142

    Re: Loop till last row

    Please use Code Tags for your code excerpts.

    If you have a column that is fully populated, that is, it has an entry for every row ... or, at least, a guaranteed entry in the last row of data, for example, column A, you can use this:

    Please Login or Register  to view this content.

    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


  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Loop till last row

    Very easy if there is a column in your data that is always filled. Say column A always has data. Then:

    Please Login or Register  to view this content.
    Gary's Student

+ 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