+ Reply to Thread
Results 1 to 5 of 5

VBA Doesn't Understand My Date Format (Autofilter)

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    VBA Doesn't Understand My Date Format (Autofilter)

    I am trying to get VBA to filter and delete dates a week later than today, however everytime I put it through the filter it just unticks every date. I can't seem to figure out what is wrong with my code- do I have to format something differently?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Doesn't Understand My Date Format (Autofilter)

    You aren't actually including your date in the filter.

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: VBA Doesn't Understand My Date Format (Autofilter)

    Quote Originally Posted by Norie View Post
    You aren't actually including your date in the filter.

    Try this.
    Please Login or Register  to view this content.
    The same issue occurs, everything is unticked and all data is hidden.

    If I actually use

    Please Login or Register  to view this content.
    VBA seems to understand that format and returns the correct data. Which is why I assumed it could be a formatting problem?
    Last edited by clattenburg cake; 06-17-2013 at 01:10 PM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Doesn't Understand My Date Format (Autofilter)

    VBA can be weird about dates, especially in filters.

    What I usually do is to add a formula in a column next to the data that indicates if the row satisfies the criteria and then filter on that column.

  5. #5
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: VBA Doesn't Understand My Date Format (Autofilter)

    Quote Originally Posted by Norie View Post
    VBA can be weird about dates, especially in filters.

    What I usually do is to add a formula in a column next to the data that indicates if the row satisfies the criteria and then filter on that column.
    Good idea, will do that.

+ 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