+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : Use Textbox.Value in AutoFilter Criteria (autofilter date)

  1. #1
    Registered User
    Join Date
    07-03-2012
    Location
    KL, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Use Textbox.Value in AutoFilter Criteria (autofilter date)

    Hello,

    I have the following code generated by autofiltering on a list of date using a text filter "Contains" and then the typed date from , "7/1/2012" and date to "7/3/2012"

    Please Login or Register  to view this content.
    I would like a search button in my UserForm to activate this code when clicked. The difference is, in place of "date from" and "date to" I would like to have date types in TextBox1 and TextBox2, which would be in the same UserForm as the search button. The following was my attempt at the search button's code:

    Please Login or Register  to view this content.

    When clicked, I get no errors, and it filters my data, but it doesn't work correctly; all of the rows get filtered out, which must mean that whatever my code's autofilter criteria resolves to, it's not in the column of date. Any ideas on how to write this criteria so that my textbox's value will get used in the filter and how to change the textbox value as date?

  2. #2
    Forum Contributor
    Join Date
    05-04-2012
    Location
    Stamford,Connecticut,USA
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: Use Textbox.Value in AutoFilter Criteria (autofilter date)

    The first thing you must do is to the define the appropriate range for your filter, you need the filter only on the first row where the data headers are (if any) For example: B11. Correct this and try your code again.

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Use Textbox.Value in AutoFilter Criteria (autofilter date)

    you cannot use asterisks with a date filter. if you are entering a complete date in the textboxes, just remove the asterisks from your code.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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