View Full Version : Solved: Hiding Worksheets

03-06-2007, 03:13 AM

I've got a user form working just how I want on an Excel sheet. I've set the form to load by clicking the command button but is it possible to have the form load automatically when the Workbook is opened?

Is it also possible to protect the data and the code so that it can't be changed by users, this form is going to be published on the intranet at work and could be used by many people at the same time. I'm not bothered whether the sheet itself is hidden or whether the sheet is protected but still visible - looking for advice on which is the best method to use really.

Could you help on this please.

Many thanks


Bob Phillips
03-06-2007, 03:33 AM
Private Sub Workbook_Open()
End Sub

This is workbook event code.
To input this code, right click on the Excel icon on the worksheet
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code

BTW, I don't think the idea of changing the caption when they click X is good, far better to have a message box on the form, say red bold label.

03-06-2007, 03:55 AM
Thanks very much for your reply and the advice about the X button. I'll give this code a try.

03-06-2007, 04:07 AM
Just a quick question. I've got the form loading on opening the wokbook now - thank you for this. Can you explain how I can protect the data and the code from being changed.

Many thanks

Bob Phillips
03-06-2007, 04:54 AM
You can password protect the code, Tools>Options in the VBIDE.

You can make the data worksheet very hidden (agin in the VBIDE).

Neither are foolproof, but they will help.

03-06-2007, 05:10 AM
Thanks very much for all your help - very much appreciated