Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default vbOK and check for variable

I have a button that exectutes a procedure when clicked....I would like to
insert something that checks the value of cell A1. If the value is Yes, I
want a box to appear asking the user if it is okay to continue. If they
choose OK, the rest of the procedure is finished, if the choose Cancel, the
procedure is terminated. If the value in A1 is anything but Yes, the
procedure is run without any question asked.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default vbOK and check for variable


If LCase(Range("A1").Value) = "yes" Then
ans = Msgbox("OK to continue?",vbOKCancel)
If ans = vbOK Then
... do your stuff
End If
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Matt" wrote in message
...
I have a button that exectutes a procedure when clicked....I would like to
insert something that checks the value of cell A1. If the value is Yes, I
want a box to appear asking the user if it is okay to continue. If they
choose OK, the rest of the procedure is finished, if the choose Cancel,

the
procedure is terminated. If the value in A1 is anything but Yes, the
procedure is run without any question asked.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default vbOK and check for variable

Sub YourMacro ()
Dim response
If LCase(Range("A1")) = "yes" Then
response = MsgBox("Do you want to continue?", 1, "Verify Run Update")
End If
If response = vbCancel Then
Exit Sub
Else
End If
'...Rest of your macro
End Sub

Mike F
"Matt" wrote in message
...
I have a button that exectutes a procedure when clicked....I would like to
insert something that checks the value of cell A1. If the value is Yes, I
want a box to appear asking the user if it is okay to continue. If they
choose OK, the rest of the procedure is finished, if the choose Cancel,
the
procedure is terminated. If the value in A1 is anything but Yes, the
procedure is run without any question asked.



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
Check if variable is range Michiel via OfficeKB.com Excel Discussion (Misc queries) 3 April 23rd 23 03:44 AM
VBA check to see if variable value is odd but not equal to 1 Dave L[_2_] Excel Discussion (Misc queries) 4 November 21st 07 01:54 AM
vbok caption I Love it Excel Programming 10 August 6th 05 06:17 PM
VbOk not responding Myriam Excel Programming 3 December 1st 04 03:51 PM
Check to see if variable is duplicate. ianripping[_59_] Excel Programming 7 May 8th 04 11:37 AM


All times are GMT +1. The time now is 09:00 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"