Run-time error '424'

gilsy

New Member
Joined
Jun 23, 2015
Messages
1
Morning
Am self teaching myself VBA but am stuck on this one. Receiving an error when I run the macro 'Run-time error 424 Object required'.

Can anyone look at this and tell me what I am missing please? It is highlighting the second line.

Private Sub CheckBox15_Click()
If CheckBox15.Value = True Then
ActiveSheet.Unprotect ("password")
Range("A20:s46").Interior.ColorIndex = 15
Range("A20:s46").Locked = True
ActiveSheet.Protect ("password")
End If
If CheckBox15.Value = False Then
ActiveSheet.Unprotect ("password")
Range("A20:s46").Interior.ColorIndex = 0
Range("A20:s46").Locked = False
ActiveSheet.Protect ("password")
End If
End Sub
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

raymhuber

New Member
Joined
May 16, 2014
Messages
17
The first thing to do would be to check and see if your userform has a Checkbox15. Click on the textbox you are trying to reference and look at the Properties window (bottom left of Visual Basic Editor) and make sure that it's name is Chackbox15 and not something else.

If it is correctly named then try referencing it more explicitly in the following manner:

Code:
UserformNameHere.CheckBoxNameHere.Value

Obviously in this code replace the userform and checkbox names with the correct ones for your scenario.

Hopefully that helps!
-Ray
 

Watch MrExcel Video

Forum statistics

Threads
1,122,564
Messages
5,596,870
Members
414,106
Latest member
Tigretto

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