Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Yes or no msg box
please help how can I assign macro in msgbox that if he click yes to go
sheet1 if he click no to stay on active sheet Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Yes or no msg box
If MsgBox("Goto Sheet1?",vbYesNo) = vbYes Then Worksheets("Sheet1").Activate End If -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "George A. Jululian" wrote in message ... please help how can I assign macro in msgbox that if he click yes to go sheet1 if he click no to stay on active sheet Thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Yes or no msg box
Option Explicit
sub Test() dim resp as long resp = msgbox(Prompt:="Go to Sheet1", buttons:=vbyesno) if resp = vbyes then worksheets("sheet1").select end if end sub George A. Jululian wrote: please help how can I assign macro in msgbox that if he click yes to go sheet1 if he click no to stay on active sheet Thanks -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Yes or no msg box
worksheets(1) for first sheet
worksheets("sheet1") for named sheet vbYesCancel might be used instead Sub stay_OR_Sheet1() MsgBox "Do you want to go sheet1", vbYesNo On Error Resume Next If vbYes Then Worksheets("sheet4").Activate If Err.Number = 9 Then MsgBox "Sorry but sheet4 no longer exits, so staying here anyway" End On Error GoTo 0 Rem rest of code End Sub For more information see HELP while within the VBA editor, and perhaps http://www.mvps.org/dmcritchie/excel/inputbox.htm -- HTH, David McRitchie, Microsoft MVP - Excel My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "George A. Jululian" wrote in message ... please help how can I assign macro in msgbox that if he click yes to go sheet1 if he click no to stay on active sheet Thanks |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Yes or no msg box
Sorry about not changing code after testing
they should all show sheet1 If vbYes Then Worksheets("sheet1").Activate |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|