If I have over 80 tabs that I'd like hide/unhide based upon values, is this code valid or is there a better way vs. coding that has an absolutely a ton of lines?
Ron![]()
Please Login or Register to view this content.
If I have over 80 tabs that I'd like hide/unhide based upon values, is this code valid or is there a better way vs. coding that has an absolutely a ton of lines?
Ron![]()
Please Login or Register to view this content.
Last edited by davesexcel; 12-15-2023 at 10:10 AM.
The criteria for showing/hiding seem to depend on different ranges of cells which makes things a bit messier. Someone with more skill than I might suggest constructing some kind of array of ranges which can be checked against individual sheets.
One easy fix which removes a number of lines from the existing code is:
In the Range("b6:f6") or Range("g6:h6"), I'd add the sheet codename reference at the start e.g. Sheet1 for clarity.![]()
Please Login or Register to view this content.
Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.
You can loop through the sheets.
This particular sample will loop through all the sheets but skip the sheet named "Not This Sheet"
It counts the cells in B6:F6
![]()
Please Login or Register to view this content.
Last edited by davesexcel; 12-15-2023 at 10:40 AM.
I'm sorry, I don't quite understand what is being said.
I'm adding what I've done so far, but I know there has to be a better way.
I'm finding that changes are required and I have copied the sheets, but it would be so much easier if I could just change 1 sheet and have the rest make the changes without messing with the formulas and of course somehow reducing the vba coding.
please don't laugh too hard how inefficent I can be lol.
Ron
The following might achieve what you're seeking. I'm assuming that you hide the sheets when the workbook is about to be closed (Q- do you show them when it's opened?)- when you are about to exit the workbook, the macro runs.close
If you prefer a button on a sheet which you can click to show or hide sheets, let me know.
EDIT- the attached workbook is an improvement so use this instead.
I don't know if it will work, but try it ...
??![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks