finding the last empty row - vba
Results 1 to 2 of 2

Thread: finding the last empty row - vba

  1. #1
    Board Regular
    Join Date
    Mar 2016
    Posts
    1,282
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default finding the last empty row - vba

    Hi
    I understand to find the last empty row, I can use this line of code

    Code:
     x = Cells(Rows.Count, 1).End(xlUp).Row
    but now I just read an article and the following line is used to find the last row

    Code:
     x = WorksheetFunction.CountA(Range("A:A")) + 1
    I do not understand how the line above can find the last row! I understand countA() function is used to count how many cells in a range which has value (text/number). But I can not see how that function is used to find the last empty row. Any help would be very much appreciate. Thanks.

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,605
    Post Thanks / Like
    Mentioned
    445 Post(s)
    Tagged
    45 Thread(s)

    Default Re: finding the last empty row - vba

    I would advise against using the 2nd approach.
    If you have blank cells in col A then the CountA method will give you the wrong row.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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