#1   Report Post  
Posted to microsoft.public.excel.misc
Ollie
 
Posts: n/a
Default Pause Macro 2

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default Pause Macro 2


Ollie wrote:
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

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ollie
 
Posts: n/a
Default Pause Macro 2

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

Thaks a lot
Regards
Ollie

"Ken Johnson" wrote:


Ollie wrote:
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


  #4   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default Pause Macro 2

You're welcome Ollie, thanks for the feedback.

Ken Johnson

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
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Macro to move to specified cells, pause for input at each? Pete in Montrose Excel Discussion (Misc queries) 1 March 5th 05 06:18 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 04:14 PM.

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

About Us

"It's about Microsoft Excel"