+ Reply to Thread
Results 1 to 6 of 6

Stop when No more data exists below

Hybrid View

  1. #1
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Stop when No more data exists below

    Hi Jim28

    Like this?
    Option Explicit
    Public Sub test()
        Dim LR As Long
        Dim i As Long
        LR = Range("A" & Rows.Count).End(xlUp).Row
        i = 1
        Do
            Cells(i, 1) = i
            i = i + 1
        Loop Until i = LR + 1
    End Sub
    The code finds the last row used in column A and performs the loop until it finds it.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  2. #2
    Forum Contributor
    Join Date
    06-24-2006
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    127

    Re: Stop when No more data exists below

    Quote Originally Posted by jaslake View Post
    Hi Jim28

    Like this?
    Option Explicit
    Public Sub test()
        Dim LR As Long
        Dim i As Long
        LR = Range("A" & Rows.Count).End(xlUp).Row
        i = 1
        Do
            Cells(i, 1) = i
            i = i + 1
        Loop Until i = LR + 1
    End Sub
    The code finds the last row used in column A and performs the loop until it finds it.

    John
    Thanks John is it possible to do it using activecells?

+ 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