Skipping part of called macro?

daverunt

Well-known Member
Joined
Jul 9, 2009
Messages
1,946
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I launch a userform from a button on the main page of my file.

The userform appears with 6 option buttons and a start/cancel button. Each selected option on pressing start runs a different macro.

At the end of every macro before Exit Sub there is a call to the userform so that it always re-appears allowing the operator to run any number of macro options until they decide to dismiss the userform using cancel.

I wanted to also add an option that calls all these macros consecutively something the operator may want to do. However the userform call at the end of each macro screws the possibility.


Call Macro1
---Macro 1 runs then displays the userform
'need to skip userform call

Call Macro2
Call macro3

Anyone see how I can get around this without copying all the macros code into another module without calls to userform.

That would be a last resort!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Are you saying that you are nesting calls to the userform? I can't see why you think that is necessary.
 
Upvote 0
Hi Glenn,

thanks for the response.

No it's not nesting calls to the userform.
I'll try and be a bit clearer.

Userform1 has 6 option buttons, each runs a macro (each macro is in a separate module). So for example the operator selects option 1.

Sub Macro 1
--does stuff--
Call Userform1
End Sub

Operator can then select another option on Userform1 say macro 5

Sub Macro 5
--does different stuff--
Call Userform1
End Sub

The operator can keep selecting options or dismiss Userform1 with the cancel button.


What I was trying to achieve is having a macro that called each of these options consecutively using Call Macro1, Call Macro2 etc without the userform1 appearing between each macro.

I hope that's clearer

However now I have tried it there are other problems coming to light so I'm going to dump that for now.
 
Upvote 0
Now I'm really confused ... you say "No it's not nesting calls to the userform." ... then you show the calling sequences that show that you are nesting calls to the userform. Does anyone else see that too?
 
Upvote 0
Ah...maybe because I missed out a minor detail. On selecting an option and pressing start the macro is launched AND the userform is dismissed at that point. It is then called back at the end of the macro.
 
Upvote 0
Ah...maybe because I missed out a minor detail. On selecting an option and pressing start the macro is launched AND the userform is dismissed at that point. It is then called back at the end of the macro.
So, can you see that not dismissing the userform, and removing the calls back to it ( in the macros ), should result in exactly what you want?
 
Upvote 0
Glenn, I couldn't see around that problem...until you pointed it out! :)

I appreciate the time and help.
 
Upvote 0

Forum statistics

Threads
1,224,519
Messages
6,179,263
Members
452,902
Latest member
Knuddeluff

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