+ Reply to Thread
Results 1 to 2 of 2

Trouble with range when using filter macro for other data sets

  1. #1
    Forum Contributor
    Join Date
    08-08-2015
    Location
    North Carolina USA
    MS-Off Ver
    MS Office 2016
    Posts
    368

    Trouble with range when using filter macro for other data sets

    Hi, I have made a macro (via recording and then cleaning up) and have run into a problem. The range of data I used for my initial record is limiting my future use of the macro to that same range (row count). I tried increasing the number, more than the range referenced in the initial record but it caused an error.

    The two formulas relating to this are below:

    ActiveSheet.Range("$A$1:$AL$132").AutoFilter Field:=16, Criteria1:="<>"

    Range("S2:S132").Copy

    I was thinking I could use dim/set lr and then reference lr but I havent ever done that while filtering - will that still work??

    Thanks for any help

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,165

    Re: Trouble with range when using filter macro for other data sets

    Hi BG

    Try to
    Dim LastRow as Double
    LastRow = Cells(Rows.Count,"A").End(xlUp).Row
    Then
    ActiveSheet.Range("$A$1:$AL$" & LastRow).AutoFilter Field:=16, Criteria1:="<>"
    and
    Range("S2:S" & LastRow).Copy

    Hope that works...
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trying to filter specific sets of data
    By klturi421 in forum Excel General
    Replies: 5
    Last Post: 05-22-2015, 01:21 AM
  2. [SOLVED] filter for different sets of colored data
    By jolenec in forum Excel General
    Replies: 5
    Last Post: 03-14-2014, 08:57 PM
  3. Trouble matching sets of data through VBA
    By turbonerds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2013, 11:17 PM
  4. Trouble with an algorithm. Multiple data sets based on date.
    By jjjkkklll7777 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2012, 08:18 PM
  5. Trouble with an algorithm. Multiple data sets!
    By jjjkkklll7777 in forum Excel General
    Replies: 1
    Last Post: 10-27-2012, 08:18 PM
  6. Replies: 0
    Last Post: 12-21-2011, 12:52 PM
  7. Macro Autofill Dynamic Range with Multiple Data Sets
    By AliveNThisMoment in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-07-2010, 03:46 PM

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