If you only have two choices you could use a message box with a Yes/No option.
Choice = MsgBox("Click Yes for Client 1, No for Client 2, Cancel for both", _
vbYes?No, "Choose Scenario")
If Choice = vbYes Then
Call Scenario1
ElseIf Choice = vbNo Then
Call Scenario2
Else
Call Scenario3
End If
Otherwise, if there are more scenarios then maybe a UserForm with a ListBox
would work. The UserForm will pause the macro, just like the message box,
until a selection is made from the list box and the subsequent code executes
to return to the main macro.
"QNiehausen" wrote:
> Sure. I currently have a macro that runs 70 scenarios, 35 for each of two
> clients. Sometimes the results require a little tweaking for either client's
> data, and then I run the macro again. However, it takes about five seconds
> per scenario, which leaves a waiting time of almost 5 minutes per cycle.
> If I only need to run the new numbers of one of the clients, it can cut the
> time in half. So, I'm trying to find a way to stop the macro with a dialog
> box that asks if I want to run Client1, Client2 or Both. From that answer, I
> can easily write in an If-Then or a Call to branch off in the proper
> direction. Problem is, I'm going nuts trying to find the way to do it.
>
> "JLGWhiz" wrote:
>
> > After looking at your posting again, I am not sure that I really understood
> > what you were asking. Could you give an example of how you would use such a
> > command?
> >
> >
> > "QNiehausen" wrote:
> >
> > > With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
> > > acquire text strings to be used for other parts of my scripts, but I can't
> > > find a simple "Get" method that simply allows the user to select from a list
> > > of strings to determine the course of the macro to continue. Y'know, like
> > > "Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
> > > I've wasted hours searching through an 867-page manual and can't find
> > > anything. "InputBox" method comes close, but it asks for the string to be
> > > typed in. I need the input option to be a pre-defined list, or even buttons.
> > > Is there a key word I'm missing? I've looked under "get", "acquire",
> > > "select", "choose", "pick". Please help.
|