Results 1 to 8 of 8

Thread: Find the last row in a range

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    15
    Hi,

    Thanks for the suggestions, I ask if there are alternatives in the event of non-adjacent columns.
    I tried to change the range of research, but I can not use the method ..

    Code:
    Riga = Columns("A:C", "G").Find

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0

    Wink try this

    Code:
    riga = Range("A:C, G:G").find
    Last edited by ashu1990; 03-21-2013 at 05:17 PM. Reason: doesnt know to post in the code window

  3. #3
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by PcMax View Post
    Thanks for the suggestions, I ask if there are alternatives in the event of non-adjacent columns.
    I tried to change the range of research, but I can not use the method ..

    Code:
    Riga = Columns("A:C", "G").Find
    ashu1990 gave you the correct syntax to use... Range("A:C,G:G") instead of Columns("A:C","G") because Columns cannot take non-contiguous ranges for its argument... however, you cannot use non-contiguous ranges with the Find function (well, you can, but it will end up finding a value in the last area of the non-contiguous range first and not look at the other areas making up the non-contiguous range, so you will not always get the correct answer doing so). I think you are back to your Max-method, but I would write it as a loop so that it is more flexible...
    Code:
    Dim Riga As Long, Ar As Range
    
    For Each Ar In Range("A:C,G:G")
      Riga = Application.Max(Riga, Ar(Ar.Count).End(xlUp).Row)
    Next
    
    MsgBox Riga

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
  •