+ Reply to Thread
Results 1 to 26 of 26

Hide Columns Older than Today

Hybrid View

  1. #1
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Hide Columns Older than Today

    Try this:

    Sub HideCols()
        Dim cell As Range
        Dim lcol As Integer
        lcol = ActiveSheet.UsedRange.Columns.Count
        For Each cell In Range(Cells(1, 1), Cells(1, lcol))
            If cell.Value < Date Then cell.EntireColumn.Hidden = True
        Next
    End Sub
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  2. #2
    Registered User
    Join Date
    10-05-2016
    Location
    GA
    MS-Off Ver
    2013
    Posts
    12

    Re: Hide Columns Older than Today

    Thanks Stephen! Works pretty good!

    I don't want it to hide column A though, so how do I modify?'

    And, where do I put this code so that it automatically updates when the file/sheet is opened? Right now I've put it under a new module and manually running the module in the VBA application.

  3. #3
    Registered User
    Join Date
    10-05-2016
    Location
    GA
    MS-Off Ver
    2013
    Posts
    12

    Re: Hide Columns Older than Today

    Thanks Stephen! Works pretty good!

    I don't want it to hide column A though, so how do I modify?'

    And, where do I put this code so that it automatically updates when the file/sheet is opened? Right now I've put it under a new module and manually running the module in the VBA application.

+ 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. If date older than today color cell RED
    By chococharlie in forum Excel General
    Replies: 5
    Last Post: 06-02-2014, 05:54 PM
  2. Auto hide columns when date is before today
    By Emrytate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 06:07 AM
  3. sum only if older than today()
    By macleod74 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-12-2013, 08:29 AM
  4. Replies: 4
    Last Post: 03-12-2012, 03:44 AM
  5. Macro to hide the columns that contains date < today
    By Darold in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2010, 10:35 AM
  6. Conditional Formatting Today and Older
    By ConsbruckR in forum Excel General
    Replies: 7
    Last Post: 03-18-2009, 04:31 PM
  7. [SOLVED] How do I add a range by date over 90 days older than today
    By John DeLosa in forum Excel General
    Replies: 4
    Last Post: 02-16-2006, 05:35 PM
  8. conditional formatting ... shade cell ... older than today
    By Mirsten Choiple in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2005, 10:07 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