Solved: Excel hide code

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

scouse13

Thread Starter
Joined
Oct 29, 2009
Messages
137
I have a workbook with at the moment 3 worksheets in it,once i have finished them,i would like to put some code in so that when the workbook is opened the vertical and horizontal scroll bars, the sheet tabs and the main bar along the top of excel, file,edit,view, insert etc are not visable or available, any idea's on what code to use please, i know i can go into tools - options and untick the scroll bars and sheet tab sections so these do not show but i can't find anywhere to unshow the top section, i would prefer this to be done automatcally when the workbook opens.

if possible could i then set up a macro on one of the worksheets(that i could password protect) that would restore these functions if i needed to alter any parts of the sheets at a later date

i do apologise for the long winded question
many thanks fo any help offered
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,641
The following code does part of what you want:
First is toggles the setting, if visible then invisible and v.v.

Sub ToggleHeaders()
ActiveWindow.DisplayHeadings = Not ActiveWindow.DisplayHeadings
Application.DisplayFormulaBar = Not Application.DisplayFormulaBar
End Sub

Turns Headers and Formula bar off
Sub HeadersOff()
ActiveWindow.DisplayHeadings = False
Application.DisplayFormulaBar = False
End Sub

Turns Headers and Formula bar on
Sub HeadersOn()
ActiveWindow.DisplayHeadings = True
Application.DisplayFormulaBar = True
End Sub

To hide the tabs, I think what you mean is to hide the sheets,
There are two options, Hidden en Very Hidden
If Didden you can unhide thme via the menu
If Very Hidden then you can only unhide them via code

I found a lot of explanations and how to's in the following site:
http://www.cpearson.com/Excel/Topic.aspx

You can copy and paste it use modify it, and I'm sure you'll find your answer there.
If you found what you need and need some extra help yous holler.
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,641
Hi, I just added a password module that I found some long time ago and frequently use in my coding.
It illustrates how you can allow certain functions (like unhide a Very Hidden sheet) :)

There is a text box with a short explanation and the buttons to try.:D
 

Attachments

scouse13

Thread Starter
Joined
Oct 29, 2009
Messages
137
thanks keeballah altered bits of the code to suit my needs on hiding etc,and this works a treat when the workbook is opened, but couldn't quite follow the password bit. let me try to explain
on the menu page i have set up a form button that calls a user form for a password to be entered, the userform has one textbox and one command button,what i would like to happen is when a password is enterd into the textbox and then the command button is pressed, if the password entered is correct then a sheet called "settings" is opened,if the password is incorrect then a msgbox appears informing the user,"password incorrect" and the userform close's.
any help appreciated, also where do i set up my password?
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,641
If it's just a password verification, why a textbox, just invoke the function and if true it's okay to continue else it's not ok. See the sample I sent you.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top