Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I would like to set up a control box that runs 1 macro when it is checked and
a different macro when I uncheck it...any suggestions? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Ultimately you can only run one macro from a check box. That being said the
macro can decide which code to run based on the value of the checkbox. Now the question is what type of checkbox do you have on your sheet. If the checkbox came from the forms toolbar then when you right click the check box one of the options will be assign macro. If it came from the Control Toolbox then it will not have assign macro. The code will depend on the type of checkbox. Reply back and we can supply you with the appropriate code. Also supply the names of the 2 different macros that you have and which one should run based on the check mark... -- HTH... Jim Thomlinson "DB74" wrote: I would like to set up a control box that runs 1 macro when it is checked and a different macro when I uncheck it...any suggestions? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Jim...I ended up piecing a few comments together and came up with
this... Private Sub CheckBox1_Click() If CheckBox1 Then Application.AutoCorrect.AddReplacement What:=".", Replacement:=":" Else Application.AutoCorrect.DeleteReplacement What:="." End If End Sub It seems to work well... Thanks. "Jim Thomlinson" wrote: Ultimately you can only run one macro from a check box. That being said the macro can decide which code to run based on the value of the checkbox. Now the question is what type of checkbox do you have on your sheet. If the checkbox came from the forms toolbar then when you right click the check box one of the options will be assign macro. If it came from the Control Toolbox then it will not have assign macro. The code will depend on the type of checkbox. Reply back and we can supply you with the appropriate code. Also supply the names of the 2 different macros that you have and which one should run based on the check mark... -- HTH... Jim Thomlinson "DB74" wrote: I would like to set up a control box that runs 1 macro when it is checked and a different macro when I uncheck it...any suggestions? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I put a checkbox from the Forms toolbar on the worksheet. I assigned that
checkbox the first macro: Option Explicit Sub RunTheMacros() Dim CBX As CheckBox Set CBX = ActiveSheet.CheckBoxes(Application.Caller) If CBX.Value = xlOn Then Call ItsCheckedMacro Else Call ItsNotCheckedMacro End If End Sub Sub ItsCheckedMacro() MsgBox "Checked" End Sub Sub ItsNotCheckedMacro() MsgBox "Not checked" End Sub DB74 wrote: I would like to set up a control box that runs 1 macro when it is checked and a different macro when I uncheck it...any suggestions? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format Control dialog box control tab | Excel Discussion (Misc queries) | |||
Control tab does not appear in format control dialogue box | Excel Discussion (Misc queries) | |||
Control End | Excel Discussion (Misc queries) | |||
spinner format control has no control tab | Excel Worksheet Functions | |||
Control Tab from Combo box- format control missing!! | Excel Discussion (Misc queries) |