+ Reply to Thread
Results 1 to 4 of 4

Autofilter by Date

  1. #1
    Registered User
    Join Date
    11-28-2011
    Location
    Barcelona
    MS-Off Ver
    Excel 2007
    Posts
    74

    Autofilter by Date

    Hello,

    I wish to use VBS to autofilter a certain column, but it's a little bit confusing.

    I have a date format column where I wish to filter, first by year.

    I have developed this code:

    Please Login or Register  to view this content.
    Unfortunately, it doesn't work.

    After filtering by year I need delete the resulting records and then perform a second filtering by day of 2012 (let's say, everythinf before the 25th of May for example).

    I used tha macro recordar, but it displays teh following code:

    Please Login or Register  to view this content.
    but I don't understand how the array is used.

    When filtering by day I obtain:

    Please Login or Register  to view this content.
    But I need this to be something dynamic. I can't write all the dates because the code is going to be used in different dates And I want to filter accordin to a date a user will give me through a date variable.

    I would much appreciate your assistance.

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Autofilter by Date

    it would have been more helpful if you had attached sample worksheet with the same configuration
    see my sample sheet attached "ragonich.xls"

    on this sheet run the macro which is in the vbeditor module and also repeated here for those who do not want to open the file

    study the macro and modify it to suit you
    the filtered data is in sheet2
    Please Login or Register  to view this content.
    Attached Files Attached Files
    I am not an expert. better solutions may be available
    $$$$venkat1926$$$$@gmail.com

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

    Re: Autofilter by Date

    Please Login or Register  to view this content.
    should filter for 2011 year only.
    Josie

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

  4. #4
    Registered User
    Join Date
    11-28-2011
    Location
    Barcelona
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Autofilter by Date

    Thank you very much for your code, I'll study it and it will certainly help me to get what I need.

+ 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