+ Reply to Thread
Results 1 to 3 of 3

Can't find my Last Row

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,990

    Can't find my Last Row

    Okay, I think I'm going crazy: I'm working on a macro, and at the outset I determine my last row, use it, then do an Advanced filter to copy unique values. I then want to refigure my last row to be the bottom of the unique list, but my "Lastrow" code throws up an error, "Method "Range of Object Global" failed". I can't figure out why. Any help would be greatly appreciated.
    Sub Macro2()
    
    Dim LastRow As Long
    
    
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    
        Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Columns("A:A").NumberFormat = "General"
        Columns("AI:AJ").NumberFormat = "General"
        
        Range("A1").FormulaR1C1 = "Concat"
        Range("A2:A" & LastRow).FormulaR1C1 = "=RC[7]&""-""&RC[3]"
        
        
        Columns("A:A").Select
        Range("A1:A" & LastRow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AH1"), Unique:=True
        
        ActiveSheet.UsedRange
        
        LastRow = Range("AH1" & Rows.Count).End(xlUp).Row

  2. #2
    Forum Contributor
    Join Date
    06-04-2013
    Location
    Moscow
    MS-Off Ver
    Office 365
    Posts
    100

    Re: Can't find my Last Row

    LastRow = Range("AH1" & Rows.Count).End(xlUp).Row - wrong. Result - 165536 for 2003 Excel and 11048576

    LastRow = Range(Rows.Count, "AH").End(xlUp).Row

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,990

    Re: Can't find my Last Row

    Thank you so much. I hate it when I get stuck on something so easy.

+ 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