![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 11:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com