Excel - Hide a tab in the workbook without hiding the functionality.

Hide a tab in the workbook without hiding the functionality.

When I hide the tab called "Country Category Table" then run the program i get...
Error: Select method of Worksheet class failed.

Is there a way to keep all the functionality and just not have the tab "Country Category Table" appear?

Thanks in advance for your help.
tesla764Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

Do you really need to select  the worksheet?

Regards
0
tesla764Author Commented:
No. But when the sheet is hidden the code bombs.
0
Rgonzo1971Commented:
What i meant is

you should get rid of the select like that

Worksheets("Test3").Range("A1").Value = 1

Open in new window

instead of
Worksheets("Test3").Select
Range("A1").Value = 1

Open in new window

Regards
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

tesla764Author Commented:
I will give that a try. It may have to wait until Monday. It's getting late in the day and I have a few other things to do before I go today. I will let you know.
Thanks.
0
tesla764Author Commented:
I will be able to try this on Monday.
Thanks and have a great weekend.
0
Ejgil HedegaardCommented:
You can not select a hidden worksheet, but you can activate it.
Then you can work with it.
Most tasks don't need selection, like writing to a cell, as mentioned by Rgonzo1971. Selection slows down program speed, so avoid it when not needed.

Other tasks, like Sorting a range, need the sheet to be active, then use

Worksheets("Country Category Table").Activate

Open in new window


Be specific by setting the sheet specification in front of every operation, otherwise the operation is performed on a visible sheet, so to avoid writing the above code with the worksheet name every time use

Dim wsCCT as Worksheet
Set wsCCT = Worksheets("Country Category Table")
wsCCT.Range("A1") = 1

Open in new window


By defining a name as a worksheet, you also get help in programming, since VBA knows that wsCCT is a worksheet, so when you write wsCCT. (wsCCT dot) you get the possibilities for a worksheet, and don't have to remember.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.