Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
Please consider this userform initialization code.
I am having trouble diagnosing the cause of the "Case without Select Case" Error that I am receiving with the line highlighted in red.
Thoughts?
Rich (BB code):
Private Sub UserForm_Initialize()
'Hide frames
F1_WCF.Visible = False
F2_WCA.Visible = False
F3_WCO.Visible = False
F4_CCF.Visible = False
F5_CCA.Visible = False
F6_CCO.Visible = False
F7_PTD.Visible = False
F8_PAD.Visible = False
F9_CNS.Visible = False
F10_CNR.Visible = False
F11_DEL.Visible = False
F12_CRQ.Visible = False
F13_WCT.Visible = False
F14_CCT.Visible = False
Select Case uf8_post.uf8_cstat.Value
Case "WCF" '1
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
Me.F1_WCF.Visible = True
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
Me.uf8a_wc_staff1.List() = ws_lists.Range("U17:U24").Value
Me.uf8a_rationale.List() = ws_lists.Range("CZ1:CZ3").Value
Me.uf8a_commby.List() = ws_lists.Range("U17:U29").Value
Me.cb_acm_ml.Enabled = False
cval = 1
Case "WCA" '2
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
F2_WCA.Visible = True
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
Me.uf8b_wc_staff1.List() = ws_lists.Range("U17:U24").Value
Me.uf8b_rationale.List() = ws_lists.Range("CZ1:CZ3").Value
Me.uf8b_commby.List() = ws_lists.Range("U17:U29").Value
cval = 1
Case "WCO" '3
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
F3_WCO.Visible = True
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
Me.uf8c_wc_staff1.List() = ws_lists.Range("U17:U24").Value
Me.uf8c_rationale.List() = ws_lists.Range("CZ1:CZ3").Value
Me.uf8c_commby.List() = ws_lists.Range("U17:U29").Value
cval = 1
Case "CCF" '4
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
F4_CCF.Visible = True
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
Me.uf8d_rationale.List() = ws_lists.Range("CZ1:CZ3").Value
Me.uf8d_commto.List() = ws_lists.Range("U17:U29").Value
Me.cb_dcm_ml.Enabled = False
cval = 1
Case "CCA" '5
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
With F5_CCA
.Visible = True
.Top = 6
.Left = 6
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
Me.uf8e_rationale.List() = ws_lists.Range("CZ1:CZ3").Value
Me.uf8e_commto.List() = ws_lists.Range("U17:U29").Value
Me.cb_ecm_ml.Enabled = False
cval = 1
Case "CCO" '6
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
F6_CCO.Visible = True
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
Me.uf8f_rationale.List() = ws_lists.Range("CZ1:CZ3").Value
Me.uf8f_commto.List() = ws_lists.Range("U17:U29").Value
Me.cb_fcm_ml.Enabled = False
cval = 1
Case "PTD" '7
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 216
F7_PTD.Visible = True
With uf8b_cancel
.Top = 168
.Left = 6
End With
With uf8b_submit
.Top = 168
.Left = 168
End With
RID = uf8_post.uf8_prin & uf8_post.uf8_rin
Me.uf8g_pstime = format(Application.WorksheetFunction.VLookup(RID, ws_psttemp.Range("A:H"), 7, False), "h:mm AM/PM")
Me.uf8g_petime = format(Application.WorksheetFunction.VLookup(RID, ws_psttemp.Range("A:H"), 8, False), "h:mm AM/PM")
Me.uf8g_pstime.Locked = True
Me.uf8g_petime.Locked = True
uf8g_apetime.Enabled = False
Me.uf8g_s_minsdev = format(TimeValue(Me.uf8g_pstime) - TimeValue(Me.uf8g_pstime), "0.00")
Me.uf8g_e_minsdev = format(TimeValue(Me.uf8g_petime) - TimeValue(Me.uf8g_petime), "0.00")
Me.uf8g_net_minsdev = format(CInt(uf8g_e_minsdev) + CInt(uf8g_s_minsdev), "0.00")
Me.uf8g_s_minsdev.Locked = True
Me.uf8g_e_minsdev.Locked = True
Me.uf8g_net_minsdev.Locked = True
cval = 1
Case "PAD" '8
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 216
F8_PAD.Visible = True
With uf8b_cancel
.Top = 168
.Left = 6
End With
With uf8b_submit
.Top = 168
.Left = 168
End With
RID = uf8_post.uf8_prin & uf8_post.uf8_rin
Me.uf8h_bookedact = Application.WorksheetFunction.VLookup(RID, ws_psttemp.Range("A:H"), 7, False)
cval = 1
Case "CNS" '9
uf8b_postcomm.Width = 248
uf8b_postcomm.Height = 303
With F9_CNS
.Visible = True
.Top = 6
.Left = 6
End With
With uf8b_cancel
.Top = 168
.Left = 6
End With
With uf8b_submit
.Top = 168
.Left = 168
End With
cval = 1
Case "CNR" '10
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 502
With F10_CNR
.Visible = True
.Top = 6
.Left = 6
End With
With uf8b_cancel
.Top = 450
.Left = 6
End With
With uf8b_submit
.Top = 450
.Left = 168
End With
cval = 1
Case "DEL" '11
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 324
F11_DEL.Visible = True
With uf8b_cancel
.Top = 270
.Left = 6
End With
With uf8b_submit
.Top = 270
.Left = 168
End With
cval = 1
Case "CRQ" '12
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 216
F12_CRQ.Visible = True
With uf8b_cancel
.Top = 168
.Left = 6
End With
With uf8b_submit
.Top = 168
.Left = 168
End With
cval = 1
Case "WCT" '13
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 216
F13_WCT.Visible = True
With uf8b_cancel
.Top = 168
.Left = 6
End With
With uf8b_submit
.Top = 168
.Left = 168
End With
cval = 1
Case Else 'CT
uf8b_postcomm.Width = 238
uf8b_postcomm.Height = 216
F14_CCT.Visible = True
With uf8b_cancel
.Top = 168
.Left = 6
End With
With uf8b_submit
.Top = 168
.Left = 168
End With
cval = 1
End Select
End Sub
I am having trouble diagnosing the cause of the "Case without Select Case" Error that I am receiving with the line highlighted in red.
Thoughts?