+ Reply to Thread
Results 1 to 7 of 7

Hide and Unhide Excel columns based on Date

  1. #1
    Registered User
    Join Date
    01-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    4

    Hide and Unhide Excel columns based on Date

    Hi all,
    I looked for an answer to this on this forum and tried running some of the VBA code I found, but I think I'm too dense to know how to modify as I was unable to make it work. I was hoping someone may be able to assist. I think it's a very simple problem but I can't seem to solve it.

    I have a Today's Date in A2. I have two weeks' worth of dates in B2-F2 and then H2-L2. I want to unhide columns with any dates before and including Today's Date and hide columns with future dates after Today's Date.

    Any assistance would be greatly appreciated!
    Thanks!

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Hide and Unhide Excel columns based on Date

    We can help you better if you can upload an example file as described in the yellow banner above.

  3. #3
    Registered User
    Join Date
    01-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    4

    Re: Hide and Unhide Excel columns based on Date

    Yes, sorry about that. Was hoping to get by without that. My IT department won't allow us uploading any company files...even if a dummy Worksheet. They won't tell me how to do this, but they can tell me not to upload of course! I'm hoping a screen shot of the data will help? Thank you for your understanding.
    Attached Images Attached Images

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Hide and Unhide Excel columns based on Date

    Try these code modules

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    4

    Re: Hide and Unhide Excel columns based on Date

    This worked maniacb!! Awesome!! Thank you so much! Just one small question, when I ran the first module, it took away this entire week, including today. Is there an issue with having "<=" beside one another?

    Again, thank you for the assistance! This is fantastic.
    Attached Images Attached Images

  6. #6
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Hide and Unhide Excel columns based on Date

    The code only looks at ranges B2:L2. The "<=" will hide todays value in that range.

  7. #7
    Registered User
    Join Date
    01-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    4

    Re: Hide and Unhide Excel columns based on Date

    I got it to work! This is excellent maniacb. Again wanted to thank you for your assistance! You are a great resource!

+ 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. VBA to hide and unhide columns based on 2 criteria
    By Oliver1470 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-21-2019, 04:33 PM
  2. Hide/unhide 2 columns based on checkbox
    By horsefish01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2015, 03:27 AM
  3. hide and unhide columns based on cell value
    By darijokesar in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-29-2014, 03:51 AM
  4. Need to Hide/Unhide Rows and Columns Based on Several Date Ranges
    By zlorinc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 04:32 PM
  5. [SOLVED] Hide/Unhide Columns based on Cell Value
    By dberg in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-26-2013, 03:36 PM
  6. Hide and unhide columns based on value of 0 or 1 (respectively) in cells G1:LG1
    By cplawren in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2012, 01:58 AM
  7. Hide/Unhide columns based on value of a cell
    By redrackham in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-24-2011, 09:14 AM

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