+ Reply to Thread
Results 1 to 4 of 4

Select next blank row

Hybrid View

  1. #1
    Registered User
    Join Date
    05-05-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Select next blank row

    Im ashamed to admit i cant figure this out. I have a bunch of data in the sheet and i want a macro to look for the first row with nothing in it and select it.

  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,188

    Re: Simple help needed - select next blank row

    Assuming there are no blanks mid data:

       Range("A1").End(xlDown).Offset(1,0).Row

    Or, safer, from the bottom:

       Range("A" & Rows.Count).End(xlUp).Offset(1,0).Row

    Regards
    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
    Registered User
    Join Date
    05-05-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Simple help needed - select next blank row

    So I tried it and it tells me "invalid use of property"

    Sub SelectNextEmptyRow()

    Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row

    End Sub

  4. #4
    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,188

    Re: Simple help needed - select next blank row

    Edit: please put your code in CODE Tags otherwise we'll both be in trouble from the Moderators.

    You only asked how to get it, I guessed you knew what you were going to do with it ;-)

    You need something like:

    Sub SelectNextEmptyRow()
    
    Dim NextBlank as Long
    
    NextBlank  = Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row
    
    ' Do something with the value you get ...
    
    Msgbox NextBlank
    
    End Sub

    Regards

+ 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