+ Reply to Thread
Results 1 to 4 of 4

finding next empty row from bottom up!!

  1. #1
    Forum Contributor
    Join Date
    03-14-2005
    Posts
    164

    finding next empty row from bottom up!!

    hi, I need to find the next empty row in my data range, but it has several empty rows throughout it.
    I need to be able to measure from the bottom of a worksheet upwards, on column B
    and then select the next empty row

    any ideas?

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Use this code:[vba]Sub lastrow()
    Dim rRng As Range
    Set rRng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    With rRng.Offset(rRng.Count, 0).Resize(1, 1).Select
    End With
    End Sub[/vba]

    places cursor in cell A99999 where 99999=the first row below the last entry in column A
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Registered User
    Join Date
    11-02-2005
    Location
    California
    Posts
    2

    Post Formula for last row

    Part of your solution will probably need this code:

    Find the very last used cell in a Column:

    Sub LastCellInColumn()

    Range("A65536").End(xlup).Select

    End Sub

    Since you know "B" is the column with the last data, change the code to read:

    Range("B65536").End(x1up).Select

    Perhaps one of the more experienced members of this group can show us how to use this...

  4. #4
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Quote Originally Posted by swatsp0p
    Use this code:[vba]Sub lastrow()
    Dim rRng As Range
    Set rRng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    With rRng.Offset(rRng.Count, 0).Resize(1, 1).Select
    End With
    End Sub[/vba]

    places cursor in cell A99999 where 99999=the first row below the last entry in column A
    Of course for Column B, simply change the reference in the above code from 'A' to 'B' each place it occurs.

    Also, I forgot to mention that if you want to skip 1 or more rows below the last entry, adjust the "Offset(rRng.Count, 0)" by changing the zero to as many rows as you want to skip. e.g to leave 2 blank rows, change the zero to a 2. If the last active row was 100, the cursor would be placed in 103 (skipping 101 & 102).

    You can assign this code to a button or simply run it by pressing Alt+F8 and selecting "lastrow" from the list.

    Does this work for you?

+ 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