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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

SteveO59L

Well-known Member
Joined
Apr 21, 2004
Messages
7,899
How about using the linked cell property for the tick box, and as part of your macro write "false" to the linked cell.


:cool:
 

styler

Board Regular
Joined
May 22, 2003
Messages
77
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
 

styler

Board Regular
Joined
May 22, 2003
Messages
77
It seems this one is not so easy, can anyone suggest something for this?
 

Forum statistics

Threads
1,147,844
Messages
5,743,510
Members
423,800
Latest member
IuneKeiki

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
Top