Results 1 to 2 of 2

Thread: Find Next Blank Row

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Find Next Blank Row

    Currently I use a loop to find the first blank row but as more and more data is entered into the spreadsheet the loop takes a long time to complete.

    I used the below but it gives me an error. Can any offer some sample code to find the first blank row without using a loop.
    Code:
    LastCompletedRow = objExcel.Range("AX:AX").End(xlDown).Row
    Thanks.

  2. #2
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    are blank rows sometimes followed by filled rows?
    i.e.
    row 1 with data
    row 2 with data
    empty row
    row 4 with data
    row 5 with data

    Or is the first blank row equal to the last row in the file?
    i.e.:
    row1 with data
    row 2 with data
    empty row (last row in excel file)


    If the empty row is the last row you can use this:

    VB Code:
    1. range("A1").select
    2. 'lastrow is the last row with data
    3. lastRow = ActiveCell.SpecialCells(xlLastCell).Row

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width