+ Reply to Thread
Results 1 to 5 of 5

Filter Data based on User Input

  1. #1
    Registered User
    Join Date
    08-18-2008
    Location
    Houston
    Posts
    17

    Filter Data based on User Input

    Hi, I have simple question...I'm trying create little script where I will be able filter based on user input. For example I have column L (Order Date), when I run macro input box will show up so user can add date. When user type in date, all data that are equal or less then user input will be deleted.

    So if, Filter all date that are less or equal ##/##/##, I got following code but when I run it it does not filter my data. Can anybody tell me what I'm doing wrong in here or can somebody tell how would I do this?

    HTML Code: 
    
    'Get the filter's criteria from the user
            sDate = InputBox("Enter the Condition to Filter ##/##/##")
    'Filter the data based on the user's input
            Selection.AutoFilter field:=12, Criteria1:="<=" & CDate(sDate), Operator:=xlAnd
    Thanks a lot

  2. #2
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Filter Data based on User Input

    Hi,

    your code is perfectly correct.. its working fine for me..

  3. #3
    Registered User
    Join Date
    08-18-2008
    Location
    Houston
    Posts
    17

    Re: Filter Data based on User Input

    Hey, I found issue why did not filtered for me, I had one of the column selected in order to Unfreeze Panes.

    Now, how can I deleted all filtered row, without deleting data that are not filltered?

    Thanka a lot.

  4. #4
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Filter Data based on User Input

    without macros ..

    press ctrl + G
    Click on Special
    Select the radio button visible cells only
    Right click on any of the highlighted cell and select delete .. delete entire row.


    using macros

    Please Login or Register  to view this content.
    Last edited by Shijesh Kumar; 08-17-2009 at 04:02 PM.

  5. #5
    Registered User
    Join Date
    08-18-2008
    Location
    Houston
    Posts
    17

    Re: Filter Data based on User Input

    Thanks a lot, work perfectly

+ 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