+ Reply to Thread
Results 1 to 8 of 8

Hiding columns based on Todays date.

  1. #1
    Registered User
    Join Date
    03-22-2018
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    19

    Hiding columns based on Todays date.

    Hi,

    I'm trying to use VBA to hide columns based on todays date.

    For example: If todays date is the 22/6/2018, I would like it hide all columns before this date.

    I think its a little different to what i have searched in google since my date format is not in dd/mm/yyyy... but rather either d , ddd or dddd

    I have attached spreadsheet
    Attached Files Attached Files
    Last edited by natkemon; 06-22-2018 at 02:01 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Hiding columns based on Todays date.

    This should work for you

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    03-22-2018
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    19

    Re: Hiding columns based on Todays date.

    It works very well.

    Further to this. I Would like to know if these 2 things are possible

    - Is it possible to run a button to UNHIDE all AND to rerun HIDE (as above).
    - Rather than hiding it at exactly the date and before... is it possible to hide before from 7 days before todays date?

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Hiding columns based on Todays date.

    .
    Or another paste in the Sheet Module :

    Please Login or Register  to view this content.

    Row 11 is used for dates from Jan 1 to Dec 31. The font and background colors were changed to match so as to blend in.

    When the sheet is activated, any column less than today's date is hidden.

    The workbook has UNHIDE also.
    Attached Files Attached Files
    Last edited by Logit; 06-21-2018 at 10:44 PM.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Hiding columns based on Todays date.

    Please Login or Register  to view this content.
    Option Explicit

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-22-2018
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    19

    Re: Hiding columns based on Todays date.

    Quote Originally Posted by alansidman View Post
    Please Login or Register  to view this content.
    Option Explicit

    Please Login or Register  to view this content.
    How would one Run these without having to go into VBA.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Hiding columns based on Todays date.

    Create a command button and link each to a button

    https://support.office.com/en-us/art...d-9c72c843a283

  8. #8
    Registered User
    Join Date
    03-22-2018
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    19

    Re: Hiding columns based on Todays date.

    *EDIT. Fixed (:
    Last edited by natkemon; 06-22-2018 at 02:01 AM.

+ 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. [SOLVED] Spell check certain columns or range based on todays date
    By yetibeard in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-14-2018, 10:06 PM
  2. [SOLVED] Finding a Formula to pull data from multiple columns based on todays date
    By BootleggerDave in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-18-2015, 06:56 PM
  3. Autohide Columns that are < todays date and > todays date by 2 & 7 days
    By Dropfiddy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2015, 03:51 AM
  4. hiding columns based on date
    By mattmorris in forum Excel General
    Replies: 1
    Last Post: 07-24-2012, 11:44 PM
  5. Un-Hiding and Hiding Columns based on Drop-Down Values in a Column.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 10-30-2011, 09:24 AM
  6. Hiding columns based on Date + 6
    By dawnmau in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-16-2010, 10:23 AM
  7. Using VB to find a range based on todays date and todays date +30
    By Steve_al in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 09:31 AM

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