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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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