Simple check box

Peter100

Well-known Member
Joined
Apr 21, 2002
Messages
765
Hi

My first intro into check boxes

I have 2 macros, one to add subtotals and one to remove subtotals.

How do I make a check box run macro 1 when it is checked, and run macro 2 when it is unchecked

Any help would be appreciated
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi, after searching the forum, I found what I thought I needed but I can't seem to make it work

I have a check box linked to cell A1 which when checked or unchecked returns the TRUE or FALSE statement OK but it doesn't then carry out the commands.

Any help would be appreciated

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("a1").Value = True Then

Range("E6").Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(7, 11, 15, _
19, 23, 24, 28, 32, 36, 40, 44, 45, 49, 53, 57, 61, 65, 66, 70, 74, 78, 82, 86, 87, 91, 95, 99, 103, 107 _
, 108, 109), Replace:=True, PageBreaks:=False, SummaryBelowData:=True

Else

Range("A6").Select
Selection.RemoveSubtotal

End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,454
Members
449,083
Latest member
Ava19

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