Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 630
- Office Version
- 365
- 2010
- Platform
- Windows
On my userform I have a frame and within that frame I have six option buttons, four labels, one datepicker, one textbox, three combo boxes, and two command buttons.
I am getting the above error when I run my For Loop and this error only occurs when the ctrl is Frame1.
Thank you
I am getting the above error when I run my For Loop and this error only occurs when the ctrl is Frame1.
VBA Code:
Private Sub CommandButton1_Click()
'declares variables
Dim ws As Worksheets
Dim sDate As String
Dim lastDateEntered As Range
Dim ctrl As Control
'Loop through all the controls on the userform
For Each ctrl In UserForm1.Controls
Select Case ctrl
Case Is = "Please select batch under review"
MsgBox "CB2"
Case Is = "Please enter the lot number"
MsgBox "TB1"
Case Is = "Please select employee from the list"
MsgBox "CB1"
Case Is = "Please select error from the list."
MsgBox "CB3"
End Select
Next ctrl
sDate = Format(Date, "mmmm")
Debug.Print sDate
Worksheets(sDate).Select
Debug.Print ActiveSheet.Name
UserForm1.Hide
batch = Me.ComboBox2.Value
MachOp = Me.ComboBox1.Value
machOpIni = Me.Label1
BRError = Me.ComboBox3.Value
Call foundBlank
Unload Me
End Sub