Untick box

styler

Board Regular
Joined
May 22, 2003
Messages
77
I have a tickbox that locks a sheet. I also have a button next to it which will unlock the sheet. Does anyone know of the code I should use to untick the box when the button is pressed?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
How about using the linked cell property for the tick box, and as part of your macro write "false" to the linked cell.


:cool:
 
Upvote 0
I tried that, only the cell has text in it and it changed the text to 'false' instead? Can I use the name of the tick box 'Approve1_Click()',


This is my code so far:








Private Sub Approve1_Click()
'
' lockout Macro
' Macro recorded 10/01/2005 by simontyler
'
line0:
P1$ = InputBox("Please enter the password 'cen', in below box to lock spreadsheet. or press cancel.")
If P1$ = "cen" Then GoTo line2
If P1$ = "" Then GoTo line1
line1:
MsgBox ("Incorrect password, Please enter a password")
GoTo line0
line2:
ActiveSheet.Protect P1$
Sheets("Extra").Protect P1$
End Sub




Private Sub unlocksheet1_Click()
line6:
P1$ = InputBox("Please enter password 'cen', to unlock")
If P1$ = "cen" Then GoTo line4
If P1$ = "" Then GoTo Line5
Line5:
MsgBox ("incorrect password, please enter a password")
GoTo line6
line4:
ActiveSheet.Unprotect P1$
Sheets("Extra").Unprotect P1$
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top