Hi all,
I have a holiday planner that has a userform which can be used to determine the number of days holiday each individual has taken off. However, recently there have been some changes whereby certain individuals have received a larger holiday allowance. So my current code is set to cater for just 20 days a year across the board.
see below.
I would like to apply a filter or something similar that looks at the name in the combobox and determines whether the employee gets 20 or 22 days a year.
Any thought's on how I can go about this?
As always, your time and help is greatly appreciated!
Thanks,
Adam
I have a holiday planner that has a userform which can be used to determine the number of days holiday each individual has taken off. However, recently there have been some changes whereby certain individuals have received a larger holiday allowance. So my current code is set to cater for just 20 days a year across the board.
see below.
Code:
Private Sub ComboBox1_Change()
Dim lngRow As Long
Dim rngData As Range
If Me.ComboBox1.ListIndex <> -1 Then
' get row number - employee range starts in row 6
lngRow = 6 + Me.ComboBox1.ListIndex
With Sheet1
Set rngData = .Range(.Cells(lngRow, "C"), .Cells(lngRow, "NC"))
End With
Me.TextBox1.Value = CountByColor(rngData, Sheet1.Range("B23")) ' holiday
Me.TextBox2.Value = CountByColor(rngData, Sheet1.Range("B24")) ' sick leave
Me.TextBox3.Value = CountByColor(rngData, Sheet1.Range("B25")) ' other
End If
TextBox4.Value = TextBox5.Value - TextBox1.Value
End Sub
I would like to apply a filter or something similar that looks at the name in the combobox and determines whether the employee gets 20 or 22 days a year.
Any thought's on how I can go about this?
As always, your time and help is greatly appreciated!
Thanks,
Adam