+ Reply to Thread
Results 1 to 2 of 2

Macro for showing tabs based on rolling dates

  1. #1
    Registered User
    Join Date
    12-08-2011
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    13

    Macro for showing tabs based on rolling dates

    Hello,

    I'm trying to get a macro to work that will make tabs visible based on a date entered into cell "c2" of each worksheet. There is a new worksheet for each day, and I'd like today's sheet's tab to be visible as well as the sheet's tabs for the upcoming 7 days, and then hiding any previous day's tabs.

    So far I have this...

    [code]
    Private Sub Workbook_Open()
    Dim ws As Worksheet
    For Each ws In Worksheets

    If (ws.Range("C2") < Date And ws.Range("C2") > (Date + 7)) Then
    ws.Visible = False
    End If

    Next ws
    End Sub

    [code]

    ...but nothing is hiding. It will hide if I have "<> Date", but then only today's tab will show, and that isn't helpful. Any suggestions will be greatly appreciated!

    Thanks!
    Last edited by a_dub_green; 01-13-2012 at 11:53 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: Macro for showing tabs based on rolling dates

    Hi,
    Try this code
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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