Message Box Error

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
Can someone tell me why I'm getting a "variable not defined" error on the lines in red font? I've used this code in another application, and didn't get this error.

Code:
Dim IsOk As Boolean
IsOk = True
Select Case True
    Case Me.cobo_Facilitator.Value = ""
        MsgBox "Please enter who Facilitated the measurement(s)."
[COLOR=#ff0000]        If response = vbOK Then[/COLOR]
            Me.cobo_Facilitator.SetFocus
        End If
        Exit Sub
        IsOk = False
End Select
If Not IsDate(Me.txt_Updated) Then
    MsgBox "Please enter a valid Updated date in MM/DD/YY format."
[COLOR=#ff0000]    If response = vbOK Then[/COLOR]
        Me.txt_Updated.SetFocus
    End If
    Exit Sub
End If
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
In the posted code response hasn't been declared.
 
Upvote 0
Not sure I understand. It's exactly the same as the code that works in another application, without error.
 
Upvote 0
I threw this in there and it seems to be working. I'm still confused as to why I had to do it here and not in the other application.

Code:
Dim Response As VbMsgBoxResult
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top