+ Reply to Thread
Results 1 to 7 of 7

VBA Code to filter 61 days out from current date

  1. #1
    Registered User
    Join Date
    12-09-2019
    Location
    Orlando, FL
    MS-Off Ver
    2016
    Posts
    3

    VBA Code to filter 61 days out from current date

    Hello All,

    I'm new to the forum (and VBA), and am hoping for some help with an issue. I'm experimenting with creating a macro by recording, and I'm running into a hiccup with one of the filter steps.

    The spreadsheet has 25 columns and I need to filter a handful of them. The last step is looking 61 days ahead, which I usually do by "Date Filters > Before..." and scrolling to the correct date on the calendar. This (as expected) has resulted in the VBA specifically filtering to the resulting date only (2/10/2020). I've tried a few things, none of which work and are probably wrong in a variety of ways haha. I'm not sure if I need to set use Dim sum or something? If so, I'm not really sure how to work that into full code, as most of what I'm finding online is a sub that is only for that single step.

    It might also be worth mentioning that the dates are actually formulas (one of them a basic Cell+/-X and the other a WORKDAY formula). I've tried substituting "today()+61" instead of "2/10/2020" but that doesn't seem to work. Any help would be very appreciated! Thanks.

    Here is the full VBA:



    Please Login or Register  to view this content.
    Last edited by mjane90; 12-09-2019 at 05:40 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 2019
    Posts
    17,940

    Re: VBA Code to filter 61 days out from current date

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,610

    Re: VBA Code to filter 61 days out from current date

    This works fine for me.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    12-09-2019
    Location
    Orlando, FL
    MS-Off Ver
    2016
    Posts
    3

    Re: VBA Code to filter 61 days out from current date

    That seems to work for me as well! Thank you so much.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,610

    Re: VBA Code to filter 61 days out from current date

    Glad to help.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  6. #6
    Registered User
    Join Date
    12-09-2019
    Location
    Orlando, FL
    MS-Off Ver
    2016
    Posts
    3

    Re: VBA Code to filter 61 days out from current date

    Done and done, thanks for that info as well.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,610

    Re: VBA Code to filter 61 days out from current date

    You're welcome and thanks for rep+.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 16
    Last Post: 08-22-2017, 11:20 AM
  2. [SOLVED] Trying to calculate- compares two dates, chooses later date, tells days to current date
    By Vicious00013 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-31-2016, 12:20 PM
  3. [SOLVED] Formula Help: Determine days total from arrival to current date then stop adding days
    By Vicious00013 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-14-2016, 12:45 PM
  4. Replies: 14
    Last Post: 04-06-2015, 09:19 PM
  5. [SOLVED] Need average of days for date values from date to current day that updates current date
    By FinGhost in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-12-2013, 04:41 PM
  6. Replies: 15
    Last Post: 06-26-2012, 07:28 AM
  7. [SOLVED] [SOLVED] Calculating days between current date and a date in future NETWORKDAYS() fun
    By Faheem Khan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-10-2005, 04:06 PM

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