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
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

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