Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock/Unlock problem
By using the two macros below, which works fine, I would like to toggle the
lock/unlock function with one button only instead of the two which I use at present. Sadly I can't get it to work, any ideas gratefully received. Jim Sub UnlockSheet() On Error Resume Next With ActiveSheet .Unprotect End With On Error GoTo 0 End Sub Sub LockSheet() On Error Resume Next With ActiveSheet .Protect End With On Error GoTo 0 End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock/Unlock problem
Hi Jim,
you can try this Sub ToggleSheet() On Error Resume Next With ActiveSheet If .ProtectContents = True Then .Unprotect Else .Protect End If End With On Error GoTo 0 End Sub HTH Frank Jim wrote: By using the two macros below, which works fine, I would like to toggle the lock/unlock function with one button only instead of the two which I use at present. Sadly I can't get it to work, any ideas gratefully received. Jim Sub UnlockSheet() On Error Resume Next With ActiveSheet .Unprotect End With On Error GoTo 0 End Sub Sub LockSheet() On Error Resume Next With ActiveSheet .Protect End With On Error GoTo 0 End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock/Unlock problem
Hi Frank
Brilliant, just what I needed. many thanks Jim "Frank Kabel" wrote in message ... Hi Jim, you can try this Sub ToggleSheet() On Error Resume Next With ActiveSheet If .ProtectContents = True Then .Unprotect Else .Protect End If End With On Error GoTo 0 End Sub HTH Frank Jim wrote: By using the two macros below, which works fine, I would like to toggle the lock/unlock function with one button only instead of the two which I use at present. Sadly I can't get it to work, any ideas gratefully received. Jim Sub UnlockSheet() On Error Resume Next With ActiveSheet .Unprotect End With On Error GoTo 0 End Sub Sub LockSheet() On Error Resume Next With ActiveSheet .Protect End With On Error GoTo 0 End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock/Unlock problem
Hi Jim
you're welcome Frank |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Lock Unlock Cell Protection | Excel Worksheet Functions | |||
Lock/Unlock cells | Excel Worksheet Functions | |||
Problem with File lock/unlock | Excel Discussion (Misc queries) | |||
Lock and Unlock cells using VBA | Excel Discussion (Misc queries) | |||
Lock / Unlock Cell | Excel Programming |