+ Reply to Thread
Results 1 to 7 of 7

lastrow of 3 columns

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    lastrow of 3 columns

    How can i change this so my lastrow= is the lowest cell of A B or C?

    Something like tis

    lastRow = Range(""lowest row filled of" A:C" & Rows.Count).End(xlUp).Row
    Many Thanks
    Last edited by Directlinq; 06-19-2009 at 10:27 AM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: lastrow of 3 columns

    Good morning Directling
    Quote Originally Posted by Directlinq View Post
    How can i change this so my lastrow= is the lowest cell of A B or C?
    If your sheet has data columns D onwards, you will need to check A, B and C and determine which is the largest. If you have no data in D onwards, then something like this should work :
    MsgBox ActiveSheet.UsedRange.Rows.Count
    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: lastrow of 3 columns

    Have a look at.
    HTML Code: 
    There may be something in there at helps.
    If not let me know.

  4. #4
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    Re: lastrow of 3 columns

    Unfortunatly i have data in D onwards
    How would i go about checking whether A B or C is higher?

    Many Thanks

  5. #5
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    Re: lastrow of 3 columns

    Wow excellent Thanks so much
    Works great

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: lastrow of 3 columns

    Would This Do It.
    Sub lastRow()
    Dim c As Object
    
        With Sheets("Sheet1").Range("A:C")
         Set c = .Find(What:="*", LookIn:=xlValues, Lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious)
        End With
    
    
    End Sub
    Last edited by D_Rennie; 06-19-2009 at 10:26 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: lastrow of 3 columns

    Didnt see it was solved.
    I done this as an example.
    Sub LastRow()
    
    Dim A As Object
    Dim B As Object
    Dim C As Object
    ' Find Last Used Cell
    With Sheets("Sheet1").Range("A:A")
         Set A = .Find(What:="*", LookIn:=xlValues, Lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious)
        End With
    With Sheets("Sheet1").Range("B:B")
         Set B = .Find(What:="*", LookIn:=xlValues, Lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious)
        End With
    With Sheets("Sheet1").Range("C:C")
         Set C = .Find(What:="*", LookIn:=xlValues, Lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious)
        End With
        
        ' Selsec rows higher or less Than Using ><
    If A.Row > B.Row & C.Row Then Range("A1:A" & A.Row).Select Else
    If B.Row < A.Row & C.Row Then Range("B1:B" & B.Row).Select Else
    If C.Row > A.Row & B.Row Then Range("C1:C" & C.Row).Select
    
    End Sub
    Im Stoked I could Help
    Last edited by D_Rennie; 06-19-2009 at 11:01 AM.

+ 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