Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MJO MJO is offline
external usenet poster
 
Posts: 2
Default How to change a macro while running others?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to change a macro while running others?

Surely, you would just create one macro with 4 arguments, pass the selected
options as parameters to the macro, and act within the macro according to
the values of the arguments.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"MJO" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default How to change a macro while running others?

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
MJO MJO is offline
external usenet poster
 
Posts: 2
Default How to change a macro while running others?

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a macro on cell value change Brettjg Excel Discussion (Misc queries) 2 March 28th 07 02:55 PM
Running a macro on cell value change Mike Excel Discussion (Misc queries) 0 March 28th 07 01:13 AM
Running a macro on cell value change Brettjg Excel Discussion (Misc queries) 0 March 28th 07 12:08 AM
Saving copied info while running a Selection Change Macro J Streger Excel Programming 1 April 5th 05 12:33 AM
running a macro when cemm contents change markshowell[_2_] Excel Programming 1 March 3rd 04 09:54 AM


All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"