Hi experts,
I'm hoping you can share your wisdom with me. I think this a simple task, but can't seem to get it right. My aim is to make a single ActiveX button that performs a "Check All" or "Un-check All" function, from the same one button, for use with a list of marlett check boxes.
When the button is clicked, I would like the macro to populate all cells in the given named ranges with the text "a". If any of the cells already contain "a", I would like the same button to clear all cells in those named ranges.
When trying to run the macro, I get the error "Run-time error '424': Object required", with the debugger highlighting the first line of code ("If Intersect....)
I am very new, so chances are I am trying to do something Excel will not allow. I've listed code below, and have been trying different arrangements of functions for 2 hours now - With no luck...
I'm hoping one of the kind guru's on here will be able to point me in the right direction. As always, any assistance is greatly appreciated. Thanks for your time guys.
I'm hoping you can share your wisdom with me. I think this a simple task, but can't seem to get it right. My aim is to make a single ActiveX button that performs a "Check All" or "Un-check All" function, from the same one button, for use with a list of marlett check boxes.
When the button is clicked, I would like the macro to populate all cells in the given named ranges with the text "a". If any of the cells already contain "a", I would like the same button to clear all cells in those named ranges.
When trying to run the macro, I get the error "Run-time error '424': Object required", with the debugger highlighting the first line of code ("If Intersect....)
I am very new, so chances are I am trying to do something Excel will not allow. I've listed code below, and have been trying different arrangements of functions for 2 hours now - With no luck...

I'm hoping one of the kind guru's on here will be able to point me in the right direction. As always, any assistance is greatly appreciated. Thanks for your time guys.
Code:
Sub Pass_All_Button()
If Intersect(Target, Union(Range("Named_Range_1"), Range("Named_Range_2"))) <> "a" Then
Target.Value = "a"
Exit Sub
End If
If Intersect(Target, Union(Range("Named_Range_1"), Range("Named_Range_2"))) = "a" Then
Target.Value = ""
Exit Sub
End If
End Sub