Hi
If you use this version of code
and any of C2 (in each worksheet) is not equal to present day (date) then will be the error because macro cannot hide all sheets in workbook. (try to hide by hand all sheets in workbookPrivate Sub Workbook_Open() Dim ws As Worksheet For Each ws In Worksheets If ws.Range("C2") <> Date Then ws.Visible = False End If Next ws End Sub)
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
Thanks again! I don't know what's happened. I have a "Summary" tab where the formula in C2 is "=today()", so that tab should always be visible (I would think). It's working again now. However, I was wondering if you had any ideas on how I could show tabs based on a rolling date. For example, I'd want to show today's tab and all the tabs for the next 7 days. Then tomorrow, I'd like today's tab to go away and show the next 7 days worth of tabs. I thought I could do this by adding more logic like <> Date + 1, <> Date + 2, etc, but that didn't work. Any suggestions?
Thank you so much!
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Hi Tom1977,
I was wondering if you had a chance to review the question I posed a couple of weeks ago. What I'm need to accomplish is to show tabs for a rolling 7 day period, meaning not just today's but also all tabs for the next week, while hiding the tabs for yesterday and previous. Do you know how I could accomplish this by modifying the code you've already been so kind to provide?
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks