View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default "Continue?" Message Box

Hi Paul,

Am Sun, 17 Jul 2016 13:30:31 -0700 (PDT) schrieb Paul Doucette:

I have code that runs when a command button is triggered, that does several things, including saving the file.
After that command button is triggered, and before the existing code runs, I would like to have a message box pop up as a warning with the option to either cancel or proceed, if any of the values on the worksheet ?Start? in cells B1, B2, B3, B4, B5, B7, B8, B9, and B10 have not changed.
By that I mean, I would like that message box to launch if any of the following is true: B1=?Customer?, B2=?Item?, B3=?Diameter?, B4=?Length?, B5=?Species?, B7=?Machine?, B8=?Contact?, B9=?Item #?, and B10=?INQ# OR OLD PO#?
All of those default values in those cells need to be changed to different values before allowing the code to run. Is this doable?


try following code before your existing code:

Sub Test()
Dim strVals As String
Dim varVals As Variant
Dim i As Long, j As Long

strVals = "Customer,Item,Diameter,Lenght,Species,Machine,Con tact,Item
#,INQ# OR OLD PO#"
varVals = Split(strVals, ",")

For i = LBound(varVals) To UBound(varVals)
j = i + IIf(i < 6, 1, 2)
If Cells(j, 2) = varVals(i) Then
MsgBox "Range B" & j & " is not changed", vbOKOnly
Exit Sub
End If
Next
'Your Code
End Sub


Regards
Claus B.
--
Windows10
Office 2016