Modify Macro to run on opening of Workbook


Posted by Dwight on June 13, 2001 11:35 AM

I have a macro set to run on opening of the workbook which begins:

Private Sub Workbook_Open()
ActiveSheet.Unprotect

I want to modify the macro so that it runs and modifies three different worksheets in the same workbook (there will also be other worksheets I don't want affected.). I assume I should revise the second line above in some way to specify the name of each worksheet and repeat the macro three times in the "This Workbook" Section of Project Explorer? Can someone confirm this approach and tell me what language to use to specify the worksheet(s)?
Thanks.



Posted by Ben O. on June 13, 2001 12:41 PM

Dwight, use this code, substituting the your sheet names for Sheet1, Sheet2, and Sheet3:

Sheets("Sheet1").Unprotect
Sheets("Sheet2").Unprotect
Sheets("Sheet3").Unprotect

-Ben