Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
Hi
I have two macros, I want to run a macro based on whether the user clicks yes to a question or no to a question, I do not know how to make this message popup on screen, Can someone help? Thanks Andrea |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
Hi,
I want to run a macro based on whether the user clicks yes to a question or no to a question, I do not know how to make this message popup on screen, Like this: Sub AskQuestion If Msgbox("Turn Left?",vbyesNo+vbQuestion)=vbYes Then TurnLeft Else TurnRight End If End Sub Sub TurnLeft() Msgbox "Going to the left!" End Sub Sub TurnRight() Msgbox "Going to the right!" End Sub Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Member of: Professional Office Developer Association www.proofficedev.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
One way is to paste this into a module and put a button on your worksheet to
call it:- Sub answerme() msg = "Answer YES or NO" response = MsgBox(msg, vbYesNo) If response = vbYes Then MsgBox ("You clicked YES") 'Run the yes macro Else MsgBox ("You clicked NO") 'Run the no macro End If End Sub Mike " wrote: Hi I have two macros, I want to run a macro based on whether the user clicks yes to a question or no to a question, I do not know how to make this message popup on screen, Can someone help? Thanks Andrea |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
Hi
Thanks for the response, The first option was what I needed as the macro works with multiple files. Only one problem so far, When my macro is looping through the questions the window does not refresh so the question windows appears behind the other one when it has been clicked.....Where can I add a window refresh so the box disappears when the question has been answered, Many thanks, Andrea On May 15, 11:17 am, Mike H wrote: One way is to paste this into a module and put a button on your worksheet to call it:- Sub answerme() msg = "Answer YES or NO" response = MsgBox(msg, vbYesNo) If response = vbYes Then MsgBox ("You clicked YES") 'Run the yes macro Else MsgBox ("You clicked NO") 'Run the no macro End If End Sub Mike " wrote: Hi I have two macros, I want to run a macro based on whether the user clicks yes to a question or no to a question, I do not know how to make this message popup on screen, Can someone help? Thanks Andrea- Hide quoted text - - Show quoted text - |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
Sub MyQuestion()
If MsgBox("Yes or No?", vbYesNo + vbQuestion) < vbYes Then MsgBox "No Macro" Else MsgBox "Yes Macro" End If End Sub " wrote: Hi I have two macros, I want to run a macro based on whether the user clicks yes to a question or no to a question, I do not know how to make this message popup on screen, Can someone help? Thanks Andrea |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
Hi
This does not answer my previous question about the updating of the questions to refresh the screen, Can someone else help? Andrea On May 15, 11:58 am, Mike wrote: Sub MyQuestion() If MsgBox("Yes or No?", vbYesNo + vbQuestion) < vbYes Then MsgBox "No Macro" Else MsgBox "Yes Macro" End If End Sub " wrote: Hi I have two macros, I want to run a macro based on whether the user clicks yes to a question or no to a question, I do not know how to make this message popup on screen, Can someone help? Thanks Andrea- Hide quoted text - - Show quoted text - |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Yes or No Box then run macro
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |