• Excel – Changing a value of a checkbox with VBA co (Excel 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Excel – Changing a value of a checkbox with VBA co (Excel 2000)

    Author
    Topic
    #412839

    I need to be able to click on a check box and have another check box change its value accordingly. How do I do this in Excel?

    Viewing 1 reply thread
    Author
    Replies
    • #906202

      What kind of check boxes are you using? Those from the Forms toolbar or those from the Control Toolbox?

      If the check boxes were created using the Forms toolbar, right-click the first check box and select Assign Macro… from the popup menu. Specify a name and click New. Make the code look like this:

      Sub CheckBox1_Click()
      ActiveSheet.Shapes(“Check Box 2”).ControlFormat.Value = _
      ActiveSheet.Shapes(“Check Box 1”).ControlFormat.Value
      End Sub

      You can find out the actual name of a check box by right-clicking it, switching to the Visual Basic Editor, and typing

      ? Selection.Name

      in the Immediate window, followed by Enter.

      If the check boxes were created using the Control Toolbox, double-click the first check box and make the code look like this:

      Private Sub CheckBox1_Click()
      Me.CheckBox2 = Me.CheckBox1
      End Sub

      You can find out the actual name of a check box by selecting it (in design mode) and looking at (Name) property in the Properties window.

    • #906203

      What kind of check boxes are you using? Those from the Forms toolbar or those from the Control Toolbox?

      If the check boxes were created using the Forms toolbar, right-click the first check box and select Assign Macro… from the popup menu. Specify a name and click New. Make the code look like this:

      Sub CheckBox1_Click()
      ActiveSheet.Shapes(“Check Box 2”).ControlFormat.Value = _
      ActiveSheet.Shapes(“Check Box 1”).ControlFormat.Value
      End Sub

      You can find out the actual name of a check box by right-clicking it, switching to the Visual Basic Editor, and typing

      ? Selection.Name

      in the Immediate window, followed by Enter.

      If the check boxes were created using the Control Toolbox, double-click the first check box and make the code look like this:

      Private Sub CheckBox1_Click()
      Me.CheckBox2 = Me.CheckBox1
      End Sub

      You can find out the actual name of a check box by selecting it (in design mode) and looking at (Name) property in the Properties window.

    Viewing 1 reply thread
    Reply To: Excel – Changing a value of a checkbox with VBA co (Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: