MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Automatically launch macro based on change in group box result

  Asked By: Boell    Date: Oct 24    Category: MS Office    Views: 909

I think what I want to do is simple. I have a group box with 2 radio
buttons. Depending on which option the user selects, I want to copy in
a range from a hidden worksheet. The only difference in the two hidden
worksheets are the calculations in the rows (row 2 has calculated
columns in one worksheet whereas row 3 has calculated columns in the
other worksheet). In otherwords, the ranges are the exact same in all
3 worksheets - they're just doing different things.

What's the code that will automatically launch the macro based on the
number coming from the group box result?



1 Answer Found

Answer #1    Answered By: Hadil Khan     Answered On: Oct 24

You need something like this

Sub LaunchBasedOnControlValue
If UserForm1.OptionButton1.Value = True Then MacroOne
If UserForm1.OptionButton2.Value = True Then MacroTwo
End Sub

This macro  should be triggered by a command btton on your UserForm
(Replace UserForm1 with your form's name) and MacroOne, MacroTwo sould
be replaced with the names of the subs you want to run for each radio