+ Reply to Thread
Results 1 to 6 of 6

autofilter based on cell input (=>)

  1. #1
    Registered User
    Join Date
    12-09-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    21

    autofilter based on cell input (=>)

    Hi, I want to apply an autofilter based on cell input in G2 - I want to filter the entire worksheet (based on column I) if the value is = or > than input value in G2
    The code below, works perfectly however only gives me values EQUAL TO G2-cell input... somehow I cannot fiugre out to change the code to giving me all values above G2 input value.
    (ps - the part that there is no filter applied if G2 is "" is also important and shall not be changed

    Many thanks!

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    ActiveSheet.AutoFilterMode = False
    Range("I5:I60000").AutoFilter
    If Range("G2").Value <> "" Then Range("I5:I60000").AutoFilter Field:=1, Criteria1:=Range("G2").Value
    End Sub

  2. #2
    Registered User
    Join Date
    11-27-2012
    Location
    Alabama
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: autofilter based on cell input (=>)

    Try this

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-09-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: autofilter based on cell input (=>)

    Hi,
    thanks a lot for getting back to me.
    I have tried your code but unfortunately it does not work - any other ideas???
    thanks

  4. #4
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: autofilter based on cell input (=>)

    Is G2 is Date..

    then try to convert date to long.. or use Cdate(g2)..

    something like..

    Please Login or Register  to view this content.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  5. #5
    Registered User
    Join Date
    12-09-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: autofilter based on cell input (=>)

    Hi,
    no G2 is not a date it is a value (e.g. 100)

  6. #6
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: autofilter based on cell input (=>)

    Sample file please..

    Try to set range.. like A1: I6000 and apply filter on field 9..

    its hard to guess structure without sample..

+ 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] Macro to manually input which field (column) to autofilter on using an input prompt
    By rin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2012, 09:35 AM
  2. [SOLVED] Autofilter Based on Cell in Another Sheet
    By Corbz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2012, 02:04 AM
  3. Autofilter based on a cell value
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2011, 09:45 AM
  4. VBA autofilter based on cell value
    By 50pingviner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2010, 12:47 PM
  5. [SOLVED] Autofilter criteria based on cell value
    By Craig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2005, 12:05 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