+ Reply to Thread
Results 1 to 7 of 7

Automatically hide columns based on date when opening Excel workbook

  1. #1
    Registered User
    Join Date
    10-30-2019
    Location
    Bourne, Lincolnshire
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Automatically hide columns based on date when opening Excel workbook

    Hello
    I have been asked to hide complete columns when opening an Excel document (single sheet) based on dates being older than the current day. I have managed to work out I need some VBA coding but that's where my knowledge stops. My Excel worksheet has the date in full (although only part of it shows due to cell formatting), i.e. 30/10/2019 through cells D3:AZV3 and when opening the document I would like all the columns hiding for all previous dates - hopefully I have attached the sample Excel document.
    Hoping someone can assist.
    Many thanks
    Attached Files Attached Files
    Last edited by helengrimsthorpe; 10-30-2019 at 05:46 AM.

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Automatically hide columns based on date when opening Excel workbook

    Add this in the workbook module:
    Please Login or Register  to view this content.
    Click the * to say thanks.

  3. #3
    Registered User
    Join Date
    10-30-2019
    Location
    Bourne, Lincolnshire
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Re: Automatically hide columns based on date when opening Excel workbook

    Fantastic, many thanks, it has worked perfectly.

  4. #4
    Registered User
    Join Date
    11-29-2019
    Location
    California
    MS-Off Ver
    Excel
    Posts
    3

    Re: Automatically hide columns based on date when opening Excel workbook

    i’m having a similar issue to the one above. I can’t figure out how to have my spreadsheet automatically hide column if a certain value is <or= to 0. any help will be appreciated

  5. #5
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: Automatically hide columns based on date when opening Excel workbook

    Which column do you want to hide, for argument the first column & check value of B1

    Make some variation of the above code
    Please Login or Register  to view this content.
    Last edited by saravnepali; 11-29-2019 at 11:27 PM.
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  6. #6
    Registered User
    Join Date
    11-14-2022
    Location
    Rotterdam, Netherlands
    MS-Off Ver
    365
    Posts
    1

    Re: Automatically hide columns based on date when opening Excel workbook

    Is this also possible to do it by week
    See first sheet invoer
    Yes i'm Dutch but for the VBA code i don't think it will make a difference
    I have 5 machines i want to put the faults in for a week and after that week i want to hide the past week
    Thx for any help in front
    Attached Files Attached Files

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Automatically hide columns based on date when opening Excel workbook

    Quote Originally Posted by mrspock View Post
    Is this also possible to do it by week
    See first sheet invoer
    Yes i'm Dutch but for the VBA code i don't think it will make a difference
    I have 5 machines i want to put the faults in for a week and after that week i want to hide the past week
    Thx for any help in front
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Open workbook, automatically hide columns based on past dates
    By PMC99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2019, 03:46 AM
  2. [SOLVED] Automatically Hide or not Hide columns, based on cell value (to the left)
    By sherylt13 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2018, 07:47 PM
  3. Hide Columns automatically based on date
    By ravisidhu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2015, 01:15 AM
  4. [SOLVED] Hide excel icons when opening workbook.
    By stuart010 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2014, 08:13 AM
  5. Hide Columns automatically based on date
    By chrisjc19 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-06-2011, 03:32 PM
  6. How do I automatically hide columns in a worksheet based on a cell value?
    By dkhedkar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2005, 09:06 PM
  7. Replies: 0
    Last Post: 03-04-2005, 02:43 PM

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