Results 1 to 8 of 8

Thread: Find the last row in a range

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by PcMax View Post
    Use the following code to identify the last row of the range.
    Can you recommend a better solution!

    Code:
        Dim Riga  As Long
        Riga = Application.WorksheetFunction.Max(Cells(Rows.Count, "A").End(xlUp).Row, _
        Cells(Rows.Count, 2).End(xlUp).Row, Cells(Rows.Count, "C").End(xlUp).Row)
        MsgBox Riga
    Give this a try...
    Code:
    Riga = Columns("A:C").Find(What:="*", SearchOrder:=xlRows, _
           SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
    And if you do not mind maintaining empty arguments, we can shorten that code line down to this by eliminating the named arguments...
    Code:
    Riga = Columns("A:C").Find("*", , xlFormulas, , xlRows, xlPrevious).Row
    Last edited by Rick Rothstein; 03-21-2013 at 04:52 AM.

Similar Threads

  1. Lookup From Cell Range By Matching Row and Column
    By paul_pearson in forum Excel Help
    Replies: 2
    Last Post: 03-07-2013, 02:02 PM
  2. Find Last Used Row In A Column Using Long Variable
    By xander1981 in forum Excel Help
    Replies: 2
    Last Post: 01-27-2013, 08:53 PM
  3. Vba Code to find value and paste on certain row
    By jwitte in forum Excel Help
    Replies: 3
    Last Post: 11-28-2012, 08:52 PM
  4. Find Last Used Row In Column
    By Rasm in forum Excel and VBA Tips and Tricks
    Replies: 2
    Last Post: 06-04-2012, 07:40 AM
  5. Find The Last Entry Row In A Column That Contains Only Numbers
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-09-2011, 05:19 AM

Posting Permissions

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