+ Reply to Thread
Results 1 to 2 of 2

Select next blank row in table of data

Hybrid View

adam2308 Select next blank row in... 10-13-2012, 08:55 AM
Bishonen Re: Select next blank row in... 10-13-2012, 09:01 AM
  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Select next blank row in table of data

    In the attached example, I have a rather large table of data and I want to add a button to the top of the worksheet that when I press it, the code find the first blank cell in column B and selects that cell. I have found code that can do this (albeit slow to execute for some reason) but I also want the screen to refocus to that cell.

    Here is the code I currently have:

    Application.ScreenUpdating = False
    Dim r1 As Range, r2 As Range
    
    Set r1 = Intersect(Range("B4:B65000"), Cells.SpecialCells(xlCellTypeBlanks))
    Set r2 = Cells(Rows.Count, "B").End(xlUp).Offset(1, 0)
    If r1 Is Nothing Then
    r2.Select
    Else
    r1(1).Select
    End If
    Application.ScreenUpdating = True
    Attached Files Attached Files
    Last edited by adam2308; 10-13-2012 at 09:03 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Select next blank row in table of data

    range("B4").end(xldown).offset(1,0).activate
    should do the job
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

+ 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