+ Reply to Thread
Results 1 to 2 of 2

Macro to filter a table using the name of the active worksheet as a criteria

Hybrid View

murtaza.khan Macro to filter a table using... 06-07-2013, 10:44 PM
MarvinP Re: Macro to filter a table... 06-07-2013, 10:55 PM
  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Canada
    MS-Off Ver
    Microsoft Excel: Mac 2011 & Microsoft Excel 2010
    Posts
    13

    Unhappy Macro to filter a table using the name of the active worksheet as a criteria

    Hi Guys,
    I am stuck while writing a macro. I need the macro to filter a table using the name of active worksheet as criteria. The code that I am writing is as below, but it doesn't seem work:

    ActiveSheet.Range("$A$1:$AE$421").AutoFilter Field:=19, Criteria1:="Activesheet.Name"

    If I hard quote the name of the sheet then, the macro, unchecks all the criteria in the filter and does not show and row in the table.

    I will highly appreciate if you someone can help me with this.

    Appreciate your help in advance.
    Thanks... Murtaza.

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

    Re: Macro to filter a table using the name of the active worksheet as a criteria

    Hi murtaza,

    Try this,

    Dim CriteriaString as String
    CriteriaString = Activesheet.Name

    Then
    ActiveSheet.Range("$A$1:$AE$421").AutoFilter Field:=19, Criteria1:= CriteriaString

    Let us know if this 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)

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