+ Reply to Thread
Results 1 to 2 of 2

Advanced Filters Date problems

Hybrid View

sglxl Advanced Filters Date problems 05-23-2012, 11:56 AM
Chippy Re: Advanced Filters Date... 05-23-2012, 02:48 PM
  1. #1
    Registered User
    Join Date
    04-07-2012
    Location
    Athens, Greece
    MS-Off Ver
    Excel 2010
    Posts
    11

    Exclamation Advanced Filters Date problems

    This is driving me insane!

    I have a ComboBox with two Text Boxes that update two separate cells on a worksheet with dates. The dates are used by the advanced filter as the Criteria range to filter two separate ranges From: and To:

    Each TextBox is formatted as follows:

    [ComboBox1.Value = Format(CDate(ComboBox1.Text), "dd-mmm-yy")]

    The Criteria range cells refer to each one of the updated cells with the following formula:

    =">="&DATE(YEAR(ptrAdvFilterFrom),MONTH(ptrAdvFilterFrom),DAY(ptrAdvFilterFrom))
    and
    ="<="&DATE(YEAR(ptrAdvFilterTo),MONTH(ptrAdvFilterTo),DAY(ptrAdvFilterTo))

    the result in the Criteria range in each instant is the date serial number i.e. >=40598

    When I run the VBA code the Advanced Filter does not work. However, if I type the the same dates manually in the cells the Advanced Filter performs correctly.

    Can someone assist please!

    Thanks/sglxl

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Advanced Filters Date problems

    See http://answers.microsoft.com/en-us/o...9-3cca03a0bde0, or http://www.ozgrid.com/VBA/autofilter-vba-dates.htm. For the latter, which applies to Advanced Filter as well as AutoFilter, "use the Long integer that represents our date in the AutoFilter criteria".
    Post responsibly. Search for excelforum.com

+ 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