+ Reply to Thread
Results 1 to 4 of 4

Auto Filter using Cell name

Hybrid View

  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    92

    Auto Filter using Cell name

    Hi I want to filter data using Cell names


    My Filtering data is in Sheet1 and the criterial data is in Sheet3

    In Sheets("Info").Range("Device_Description_1") I have the value WAVE-274.

    So I have wrote a working code to filter data using

    Sub Macro2()
        Range("A1").Select
        Selection.AutoFilter
        ActiveSheet.Range("$A$1:$N$221337").AutoFilter Field:=3, Criteria1:= _
            "=*WAVE-474*"
      End Sub

    but now I want to change Criteria1:= "=*WAVE-474*" and make Criteria1:= Sheets("Info").Range("Device_Description_1").Value.

    As long as the cell contains "Device_Description_1" Value, it should filter but I am not getiing any data.

    Any idea how to do it?

    Thanks In advance,

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Auto Filter using Cell name

    Sub Macro2()
    
        Range("A1").Select
        Selection.AutoFilter
        ActiveSheet.Range("$A$1:$N$221337").AutoFilter Field:=3, Criteria1:=Sheets("Info").Range("Device_Description_1")
    End Sub
    does this not work?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    12-04-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Auto Filter using Cell name

    Hi,

    No it didn't work. Device_Description_1 value is only "WAVE-474" but the output of filtered data has "WAVE-274-K9-RF". So it is only part of the output, not exactly the same. That's why I used
    ActiveSheet.Range("$A$1:$N$221337").AutoFilter Field:=3, Criteria1:="=*WAVE-274*"
    before (Criteria1:="=*WAVE-274*").

    So I thought if I do

    Sub Filter_Data()
        
        Range("A1").Select
        Selection.AutoFilter
        ActiveSheet.Range("$A$1:$N$221337").AutoFilter Field:=3, Criteria1:=Sheets("Info").Range("Device_Description_1").Value & "*"
    End Sub
    But it doesn't work either

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Auto Filter using Cell name

    Try this...

    Sub Macro2()
    
    With Sheets("Info").Range("Device_Description_1").Cells(1)
        If .Value <> "" Then
            Range("$A$1:$N$221337").AutoFilter Field:=3, Criteria1:="=*" & .Value & "*"
        End If
    End With
    
    End Sub


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

+ 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. [SOLVED] Auto Populate cell based on auto filter selection from table in same sheet
    By missydanni in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-02-2013, 05:03 PM
  2. auto filter event code based on cell two cell value
    By njan1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2013, 09:02 AM
  3. Replies: 2
    Last Post: 06-03-2012, 03:33 PM
  4. Active Cell in Auto Filter
    By Michael Link in forum Excel General
    Replies: 1
    Last Post: 08-01-2006, 11:30 AM
  5. [SOLVED] Auto filter from a cell
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2006, 11:10 AM

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