Pause Macro 2

O

Ollie

have another pause macro problem.

I have created a macro
Dim myStr As String
myStr = InputBox(Prompt:="Please enter your name")
Range("a3").Select
ActiveCell.FormulaR1C1 = myStr
MsgBox " You entered:" &myStr
"other code that does more

The input box has 2 options OK and Cancel.

If I click on cancel it still continues with the "other code that does more"
instead of quiting the macro.

Would appreciate any help.

Thanks
 
K

Ken Johnson

Ollie said:
have another pause macro problem.

I have created a macro
Dim myStr As String
myStr = InputBox(Prompt:="Please enter your name")
Range("a3").Select
ActiveCell.FormulaR1C1 = myStr
MsgBox " You entered:" &myStr
"other code that does more

The input box has 2 options OK and Cancel.

If I click on cancel it still continues with the "other code that does more"
instead of quiting the macro.

Would appreciate any help.

Thanks

Hi Ollie,

If you need to exit the macro when the user clicks cancel you will need
something like

If myStr = "" Then
Exit Sub
End If

Ken Johnson
 
O

Ollie

Thanks again Ken.
This was an addition to yesterdays question.
Its so good to get this help.

Thaks a lot
Regards
Ollie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top