I am trying to figure out what is causing my code to derail and could use another set of eyes looking at it.
I have a combobox (cmbEmp1) that is populated with a list of employees.
I have 4 text fields (txtTime1,2,3,4) that have their Visible property set to False upon loading my userform (frmTimeCard).
I am trying to make the text fields visible when any employee in the list is selected, and disappear if the combobox is cleared. Below is the code I have so far:
As an amateur at VBA (5 days and counting), I am having trouble debugging.
I have a combobox (cmbEmp1) that is populated with a list of employees.
I have 4 text fields (txtTime1,2,3,4) that have their Visible property set to False upon loading my userform (frmTimeCard).
I am trying to make the text fields visible when any employee in the list is selected, and disappear if the combobox is cleared. Below is the code I have so far:
HTML:
Private Sub cmbEmp1_Change()
Dim index As Integer
Dim x As Long
index = cmbEmp1.ListIndex
For x = 1 To 4
frmTimeCard.Controls("txtTime" & x).Clear
Select Case index
Case Is = 0
For x = 1 To 4
frmTimeCard.Controls("txtTime" & x).Visable = False
Next x
Case Else
For x = 1 To 4
frmTimeCard.Controls("txtTime" & x).Visable = True
Next x
End Select
End Sub
As an amateur at VBA (5 days and counting), I am having trouble debugging.