ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Branching in a macro (https://www.excelbanter.com/excel-programming/291543-branching-macro.html)

BillShut

Branching in a macro
 
I want an msgbox, to accept a default of username choose yes. If yes
it will go to a point in the macro and continue.

If no, it will ask for input or a second default of "Comment" and then
continue to the same point in the macro.

How do I get it to branch?

Or even better, can I get it to choose 1 - being Username, 2 - being
"Comment" 3 - being input all in the same input box / message box?

Thanks very much,

Bill

Bob Phillips[_6_]

Branching in a macro
 
You should be careful with that name.

In essence, you don't.

ans = MsgBox("Question", vbYesNo)
If ans = vbYes Then
inp = InputBox("Comment")
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"BillShut" wrote in message
m...
I want an msgbox, to accept a default of username choose yes. If yes
it will go to a point in the macro and continue.

If no, it will ask for input or a second default of "Comment" and then
continue to the same point in the macro.

How do I get it to branch?

Or even better, can I get it to choose 1 - being Username, 2 - being
"Comment" 3 - being input all in the same input box / message box?

Thanks very much,

Bill





All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com