Results 1 to 6 of 6

How to add lastCol and lastrow to macro

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    How to add lastCol and lastrow to macro

    I am trying to apply lastrow lastcolumn, but not getting it right.

    I get the error "The extracted range has a missing or illegal field name"

    Thanks
    Sub CopyToOtherSheet1()
    
            Dim lastRow As Long
            Dim lastCol As Long
            Dim colChr As String
    
    
            With Sheets("360-Tableau")
                lastCol = .Cells(2, .Columns.Count).End(xlToLeft).Column
                lastRow = .Cells(.Rows.Count, lastCol).End(xlUp).Row
            End With
    
    Sheets("360-Tableau").Range(Cells(1, 1), Cells(lastRow, lastCol)).AdvancedFilter Action:=xlFilterCopy, _
    CopyToRange:=Sheets("360").Range("A1"), _
    Unique:=False
    
    Application.DisplayAlerts = False
    Sheets("360-Tableau").Delete
    Application.DisplayAlerts = True
    
    End Sub
    Last edited by capson; 08-18-2013 at 11:46 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sum Lastrow formula!!
    By Hurricanefly in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-17-2013, 11:35 AM
  2. 'lastrow =' How long does statement 'work' in macro?
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2012, 08:39 AM
  3. Copy From LastRow to LastRow+7
    By dvent in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2010, 06:56 AM
  4. Reference LastCol VB
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2008, 07:24 PM
  5. Autofill to lastrow
    By Pedros in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-11-2007, 12:55 AM

Tags for this Thread

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