This post demonstrates using a single button (form control) to turn a macro on or off.

VBA Macro

Sub Button1_Click()

If ActiveSheet.Shapes("Button 1").TextFrame.Characters.Text = "Checkboxes: On" Then
    ActiveSheet.Shapes("Button 1").TextFrame.Characters.Text = "Checkboxes: Off"
    Call RemoveCheckboxes
Else
    ActiveSheet.Shapes("Button 1").TextFrame.Characters.Text = "Checkboxes: On"
    Call Addcheckboxes
    ActiveSheet.Range("A1").Select
End If

End Sub

I am not going to post the add and remove checkboxes vba code again. You can find them here:

Excel vba: Add checkboxes to a sheet (1/2)

In this post I will demonstrate how to create checkboxes in nonempty rows. VBA code   Where to copy vba […]

Comments(3) Filed in category: Check-boxes, Excel

Copy VBA code

  1. Copy code
  2. Press Alt+F11
  3. Go to the "Insert" menu
  4. Click "Module"
  5. Paste to code module

How to create a button

  1. Go to tab "Developer"
  2. Click "Insert" button and button (form control)
  3. Draw a button
  4. Assign macro "Button1_Click"
    1. Click OK!

Download excel *.xlsm file

Toggle macro on off.xlsm