View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default ActiveSheet.Protect UserinterfaceOnly:=true

Tim,

Not sure that I understand what you mean???
ActiveSheet.Protect UserinterfaceOnly:=true
Will protect the "Active" sheet and allow changes made
via VBA. Note that the protection is volatile meaning
that if the workbook is opened with macros disabled,
the sheet won't be protected. This means that you
have to run this code each time the workbook is
opened and macros have to be enabled.
Now you could specify a particular sheet or loop through
groups of sheets:
Worksheets("Sheet1").Protect UserinterfaceOnly:=true
Worksheets("Sheet2").Protect UserinterfaceOnly:=true
You don't have to have the sheet activated to protect it in this manner.

Is there a comand line that will allow changes to be made
to a worksheet no matter what sheet is currently activated?

If the sheets are protected using the above method, you can have
any sheet active and change data on another sheet. There isn't
any specific command line to do this.

If Sheets1 & 2 are protected as above and sheet2 is the "Active"
sheet, Worksheets("Sheet1").Range("A1").Value = "abc"
will work fine.

John

Tim wrote:

I need to make changes to a multiple sheet workbook. Some of the
cells are protected. I know the above command in my Subject line will
allow this on a sheet by sheet basis, but I need something else. Is
there a comand line that will allow changes to be made to a worksheet
no matter what sheet is currently activated?

Thanks for the help.