Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am using a Custom Button to lock/unlock a sheet
If ActiveSheet.ProtectContents = True Then ActiveSheet.Unprotect With Application.CommandBars.ActionControl .Caption = "Protect Sheet" End With Exit Sub End If With Application.CommandBars.ActionControl .Caption = "Un Protect Sheet" End With ActiveSheet.Protect if the sheet is unlocked the code will work and change the button text but when I go to relock the sheet the line of code to change the caption to unlock sheet errors out with Object Variable or With block variable not set why does it work outsied the if statement and not inside thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto Rename Excel Sheets in Workbook | Excel Worksheet Functions | |||
Cell References | Excel Discussion (Misc queries) | |||
Named Ranges | Excel Worksheet Functions | |||
Asked previously...can this not be done in excel | Excel Discussion (Misc queries) | |||
Using a relative SHEET reference for source data in a chart | Charts and Charting in Excel |