Message Box Error

reberryjr

Active Member
Joined
Mar 16, 2017
Messages
499
Office Version
  1. 2013
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
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
In the posted code response hasn't been declared.
 

reberryjr

Active Member
Joined
Mar 16, 2017
Messages
499
Office Version
  1. 2013
Platform
  1. Windows
Not sure I understand. It's exactly the same as the code that works in another application, without error.
 

reberryjr

Active Member
Joined
Mar 16, 2017
Messages
499
Office Version
  1. 2013
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,511
Messages
5,596,576
Members
414,079
Latest member
Frills

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
Top