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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
How about using the linked cell property for the tick box, and as part of your macro write "false" to the linked cell.


8-)
 
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,222,194
Messages
6,164,508
Members
451,900
Latest member
lamski

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