I have a form that I've created in excel. I am trying to write a macro to run behind it to work along with the check box ActiveX Controls I've inserted in the document. I asked one of my programmers to help and he said he cannot get the macro to work, it's saying the macro needs to be registered. How do I do this?

Dani AI

Generated

Two things are happening in this thread: 1) the distribution/“registered” problem, and 2) the If/Then behavior you want for the group of checkboxes. was right to point you toward using the control’s Value instead of trying to select shapes — that’s the right approach. Below are practical steps to diagnose the registration problem and a concise, reusable macro pattern you can drop into the sheet module to make a master checkbox toggle its component boxes.

Quick diagnostics / distribution tips

  • Ask whoever sees the “needs to be registered” error to open the file and then press Alt+F11. In the VBE check Tools -> References for any entry that begins with "MISSING:" — that reveals a missing library.
  • ActiveX registration problems come from missing OCX/DLLs on the recipient machine or from macro security blocking code. For distribution to many people, prefer Form controls (Developer -> Insert -> Form Controls) with LinkedCell values or sign the workbook with a digital certificate and instruct users to enable macros or trust the location. Replacing sheet ActiveX checkboxes with Form checkboxes is the most portable option.
  • Ensure control names in the Properties window match the names used in code (Design Mode -> right-click -> Properties).

Reusable macro pattern
Place this helper in a standard module and the Click handler in the sheet module that holds the ActiveX checkboxes.

Sub SetCheckboxGroup(names As Variant, state As Boolean)
    Dim nm As Variant
    For Each nm In names
        On Error Resume Next
        ActiveSheet.OLEObjects(CStr(nm)).Object.Value = state
        On Error GoTo 0
    Next nm
End Sub

Example sheet-level Click event for the master checkbox:

Private Sub CheckBox1_Click()
    If Me.CheckBox1.Value = True Then
        Call SetCheckboxGroup(Array("CheckBox2","CheckBox7","CheckBox3","CheckBox4","CheckBox5","CheckBox8","CheckBox20"), False)
    End If
End Sub

Notes and cautions

  • Adjust the array of names to match the actual Name property for each checkbox.
  • Using LinkedCell (Form controls) often simplifies logic: you can test cell values instead of control objects.
  • If a recipient still reports errors, capture the exact error message and the Excel version — that helps pinpoint whether it’s macro security, a missing library, or an unregistered ActiveX control.

Recommended Answers

All 7 Replies

I have a form that I've created in excel. I am trying to write a macro to run behind it to work along with the check box ActiveX Controls I've inserted in the document. I asked one of my programmers to help and he said he cannot get the macro to work, it's saying the macro needs to be registered. How do I do this?

I have a solution for you...
its simple... reply me to know about it instantly...
Thanks
Lakshm

If you post the macro code, we can help you out a little bit more.

If you post the macro code, we can help you out a little bit more.

There isn't a code, YET. When I checked with my programmer, he said he can't open the file I e-mailed him because of the macro. So my understanding is since Excel created a macro when I inserted a control button option to the form, only my computer will be able to read the macro. I wanted to e-mail this form for people to use, however, if everyone needs to register it, that's going to make it difficult. How do/can I go about getting this out for people to use and get a code written for a macro to make it fool proof, any suggestions?

The macro is stored/saved inside of the excel document. He might have macro's disabled (or may not trust you, so wouldn't run your macro), in which case it wouldn't load it..... but the macro is saved in the file.... so if you attach the .xls document to a post here, we can download it and see what it's doing....

I can't thank you enough for your help! I hope we can get this to work.

The method you are using is incorrect. By using the shapes collection, and then accessing the Select function, makes it the same as if you hold down shift and click a control. It just highlights the control, as if it were text, or a cell, or some other object. In order to actually check one of the box, you need to access it directly, using the .value property, as such:

ActiveSheet.CheckBox6.Value = 1
ActiveSheet.CheckBox7.Value = 1
ActiveSheet.CheckBox3.Value = 1

Something important to note here, is that you use boolean logic to represent the check mark... for example, replacing the = 1 to = 0 would take the check mark out of the box....

I think I understand and I’ve got something here… I think what I want is an If-Then construct, right? Do you know a code that will do this?
[if checkboxes 2"Sodium", 7"Potassium", 3"Chloride", 4"CO2", 5"BUN", 8"Glucose", 20"Creatine" = 1, then checkbox 1"Basic Metabolic"=1 and checkboxes 2 "Sodium", 7 "Potassium", 3"Chloride", 4"CO2", 5"BUN", 8"Glucose", & 20"Creatine" = 0?]
I’m using Boolean logic to represent the check marks as you said, the quoted words are the numbers of their coinciding check box beside them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.