How to change a macro while running others?
If you name your macros with numbers
You could do something like this pseudo code
Dim v(1 to 4)
for i = 1 to 4
v(i) = 12
Next
' React to Step 1
Select Case Step1_Value
if 100
v(1) = 1
if 200
v(1) = 6
End Select
' React to Step 2
Select Case Step2_Value
Case 15
v(2) = 3
Case 20
v(2) = 4
end Select
' react to Step 3
Select Case Step3_Value
Case "A"
v(3) = 5
Case "B"
v(3) = 10
End Select
' React to Step 4
Select Case Step4_Value
Case "MI"
v(4) = 2
Case "XYZ"
v(4) = 8
End Select
for i = 1 to 4
Application Run "Macro" & v(i)
Next
Or you could put macro names in the array or whatever.
--
Regards,
Tom Ogilvy
"MJO" wrote in message
...
I am not sure I understood your question... each step is sequential (one
uses
filters, other hides columns, other uses filters on a different column,
....)
and I have all the "small" macros running.
This is what I have now:
When the user selects the option in step 1, the macro runs. And the same
happens for step 2, 3 and 4. So, the user has to "see" macros running.
This
is the reason why I would like to call these 4 macros from only one. This
way
the user could do the selections and then at the end go to the selected
analysis
"Toppers" wrote:
How do the options affect the logic of the macro(s) i.e. how does the
selection value determine what each step does?
"MJO" wrote:
Hello
I have one excel file where the uer has to make selections in 4 steps:
1st step 7 options
2nd step 10 options
3rd step 2 options
4th step 3 options
So, at the end, the user has 420 possible combinations.
I don't want to have 420 macros, but only one per option (so, 22).
I would like to create a macro that is run at the end that could be
Sub Final()
Call Step1.a
Call Step2.c
Call Step3.a
Call Stelp4.d
End Sub()
But this macro would be created/written the user makes his choices...
Is this possible? Can anyone help me on doing this?
Thanks
|