View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
LucyRB LucyRB is offline
external usenet poster
 
Posts: 7
Default Need help re VBA for Worksheet Open Event

Just upgraded from Office 97 (Excel 97) to Office 2003 (Excel 2003). Now
getting "Unprotect Worksheet" prompt with "OK" or "CANCEL" after enabling
macros, for each password-protected worksheet in workbook developed before
upgrade. From my research, it is likely a problem with my Workbook_open
macro. NEED HELP!

Workbook has 5 worksheets. Users enter data in "unlocked" cells. Have
password protected sheets to protect other formulas/formatting. Because
users must be able to use auto-filter at top of worksheet (doesn't work when
worksheet is protected), I pieced together the macro below. Since upgrade,
after enabling macros, users must hit "cancel" for each protected worksheet.
Many people access the workbook numerous times per day, so this is not
functional.

I only know how to "cut & paste" re VBA, so have exhausted my VBA knowledge.
I'm hoping you can help me again!

Private Sub Workbook_Open()
Application.ScreenUpdating = False

With Application
.Calculation = xlManual
.MaxChange = 0.001
.CalculateBeforeSave = False
End With

Dim WS As Worksheet
For Each WS In Worksheets
WS.EnableAutoFilter = True
WS.Protect contents:=True, userInterfaceOnly:=True
Next WS
End Sub