See Below.
See Below.
Last edited by ReeceT; 08-18-2011 at 04:38 AM.
Hi,
I have a pice of code that I am using to hide sheets. As the workbook grows the need to amend the code becomes quite laborious.
Is it possible to use a wildcad to shorten this array sequence below:
The sheets are refering to the CodeName as opposed to the SheetName.Please Login or Register to view this content.
I tried
but it does not like it.Please Login or Register to view this content.
Thanks
Hi ReeceT, adapt your code to something like the following:Let me know how it goes for you.Please Login or Register to view this content.
If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.
---Keep on Coding in the Free World---
Can't get it to work. Sorry am quite new to VBA. This is the whole code that I am using:
Please Login or Register to view this content.
Hi ReeceT,
TryPlease Login or Register to view this content.
Last edited by Mordred; 08-17-2011 at 10:19 AM.
Grrr.... I am useless...
Using that code it does not auto hide the sheets anymore.
I have attached the file if this helps....
Many Thanks
I'm sure you are not useless so don't think it.
Edit: Nevermind my ramblings !
Hi ReeceT,
I have asked for help from the true gurus of this site. I'm sure your problem will be solved soon.
I have sheets with the code name as master 1,2,3,4 as can be seen in the VBA window to the left. These sheets are always on show as they are the heading sheets. Their actual sheet names are Ttile, P&L, Site Info and PVE.
Now when I click into say the sheet named "P&L" with the codename Master2 the 5 other P&L sheets appear. Then if I click onto "Site Info" with the codename Master3 the 5 P&L sheets hide and the "Site Labour" and "Site Costs" sheets appear.
I have to use the codenames as this then allows the operator to change the sheet name on the tab without messing up the code and getting errors.
Now with this simple example there are only 4 Master sheet codenames, however this is likley to increase to over 15 when I use on the full model,
I would like the ability to add a wildcard ib the array so that I done have to add or delete a CodeName Master sheet everytime I create one.
Cheers
How about:
Please Login or Register to view this content.
Anyone who confuses correlation and causation ends up dead.
Thanks for that. That is one hurdle over, however, this code would work for the Master1 only. I need to replicate for the code contained within Master2, Master3 and any further Master sheets created also.
If I use that code then the hidden sheets within the other CodeName Master2-4 disappear.
I don't really know what your basis is for hiding, but you basically extend that principle. So you can use:
or whatever your test is for hiding/showing them.Please Login or Register to view this content.
Basis for hiding is that I often have workbooks with 50 or so tabs and it is a pain selceting them by scrolling or right clicking on the arrow.
If I have heading tabs then it works in much the same was as grouping on the windows taskbar.
I wasn't asking why you were doing it, but what the coding logic would be. You need to extend the logic of the codename like "blah*" to hide/show the ones you want for a given situation.
I will give it a go hen I get home form work. Thanks for the help.
Sorted now. Thanks romper
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks