I have multiple ComboBoxes (ie., 2137-2150) with attendance codes and I was wondering if there is anyway to shorten?
Cross-posted: http://www.excelforum.com/excel-pro...ms-is-it-possible-to-shorten.html#post3948039
Private Sub ComboBox2137_Click()
ComboBox2137.Text = Trim(Split(ComboBox2137.List(ComboBox2137.ListIndex), "-")(0))
End Sub
With Sheet1.ComboBox2137
.AddItem " BD - LABOR/MANAGEMENT"
.AddItem " BK - GRIEVANCE AND APPEALS"
.AddItem " CB - TRAVEL COMPENSATORY TIME EARNED"
.AddItem " CC - COMPENSATORY CALLBACK"
.AddItem " CD - CREDIT HOURS EARNED"
.AddItem " CE - TRAVEL COMPENSATORY TIME TAKEN"
.AddItem " CN - CREDIT HOURS TAKEN"
.AddItem " CT - COMPENSATORY TIME TAKEN"
.AddItem " DA - BIRTH OF SON/DAUGHTER OR CARE OF NEWBORN"
.AddItem " DB - ADOPTION OR FOSTER CARE"
.AddItem " DC - CARE FOR SPOUSE, SON, DAUGHTER, OR PARENT WITH SERIOUS HEALTH CONDITION"
.AddItem " DD - SERIOUS HEALTH CONDITION OF EMPLOYEE"
.AddItem " DE - FEFFL FAMILY CARE/BEREAVEMENT"
.AddItem " DF - ADOPTION RELATED PURPOSES"
.AddItem " DM - WOUNDED VETERAN"
.AddItem " HC - HOLIDAY CALLBACK"
.AddItem " HF - HOLIDAY WORK - FIRST SHIFT (FWS EMPLOYEE)"
.AddItem " HG - HOLIDAY WORK - (GS EMPLOYEE)"
.AddItem " HS - HOLIDAY WORK - SECOND SHIFT (FWS EMPLOYEE)"
.AddItem " HT - HOLIDAY WORK - THIRD SHIFT (FWS EMPLOYEE)"
.AddItem " KA - LEAVE WITHOUT PAY (LWOP)"
.AddItem " KB - SUSPENSION"
.AddItem " KC - ABSENCE WITHOUT PAY (AWOL)"
.AddItem " KD - OFFICE OF WORKERS COMPENSATION PROGRAMS (OWCP)"
.AddItem " KE - FURLOUGH"
.AddItem " KG - MILITARY FURLOUGH(LWOP) - CALLED TO ACTIVE DUTY"
.AddItem " LA - ANNUAL LEAVE"
.AddItem " LB - ADVANCED ANNUAL LEAVE"
.AddItem " LC - COURT LEAVE"
.AddItem " LG - ADVANCED SICK LEAVE"
.AddItem " LH - HOLIDAY LEAVE"
.AddItem " LM - MILITARY LEAVE"
.AddItem " LN - ADMINISTRATIVE LEAVE"
.AddItem " LS - SICK LEAVE"
.AddItem " LT - TRAUMATIC INJURY (CONTINUATION OF PAY (COP))"
.AddItem " LU - DAY OF INJURY"
.AddItem " ND - NIGHT DIFFERENTIAL (GS EMPLOYEE)"
.AddItem " OC - OVERTIME CALLBACK"
.AddItem " OS - OVERTIME SCHEDULED"
.AddItem " OU - OVERTIME UNSCHEDULED"
.AddItem " RG - REGULAR (GS EMPLOYEE)"
.AddItem " RF - REGULAR - FIRST SHIFT (FWS EMPLOYEE)"
.AddItem " RS - REGULAR - SECOND SHIFT (FWS EMPLOYEE)"
.AddItem " RT - REGULAR - THIRD SHIFT (FWS EMPLOYEE)"
.AddItem " RN - REGULAR - PAID NOT WORKED (FIREFIGHTER)"
.AddItem " RW - REGULAR - AGENCY TRAINING (FIREFIGHTER)"
End With
Cross-posted: http://www.excelforum.com/excel-pro...ms-is-it-possible-to-shorten.html#post3948039
Private Sub ComboBox2137_Click()
ComboBox2137.Text = Trim(Split(ComboBox2137.List(ComboBox2137.ListIndex), "-")(0))
End Sub
With Sheet1.ComboBox2137
.AddItem " BD - LABOR/MANAGEMENT"
.AddItem " BK - GRIEVANCE AND APPEALS"
.AddItem " CB - TRAVEL COMPENSATORY TIME EARNED"
.AddItem " CC - COMPENSATORY CALLBACK"
.AddItem " CD - CREDIT HOURS EARNED"
.AddItem " CE - TRAVEL COMPENSATORY TIME TAKEN"
.AddItem " CN - CREDIT HOURS TAKEN"
.AddItem " CT - COMPENSATORY TIME TAKEN"
.AddItem " DA - BIRTH OF SON/DAUGHTER OR CARE OF NEWBORN"
.AddItem " DB - ADOPTION OR FOSTER CARE"
.AddItem " DC - CARE FOR SPOUSE, SON, DAUGHTER, OR PARENT WITH SERIOUS HEALTH CONDITION"
.AddItem " DD - SERIOUS HEALTH CONDITION OF EMPLOYEE"
.AddItem " DE - FEFFL FAMILY CARE/BEREAVEMENT"
.AddItem " DF - ADOPTION RELATED PURPOSES"
.AddItem " DM - WOUNDED VETERAN"
.AddItem " HC - HOLIDAY CALLBACK"
.AddItem " HF - HOLIDAY WORK - FIRST SHIFT (FWS EMPLOYEE)"
.AddItem " HG - HOLIDAY WORK - (GS EMPLOYEE)"
.AddItem " HS - HOLIDAY WORK - SECOND SHIFT (FWS EMPLOYEE)"
.AddItem " HT - HOLIDAY WORK - THIRD SHIFT (FWS EMPLOYEE)"
.AddItem " KA - LEAVE WITHOUT PAY (LWOP)"
.AddItem " KB - SUSPENSION"
.AddItem " KC - ABSENCE WITHOUT PAY (AWOL)"
.AddItem " KD - OFFICE OF WORKERS COMPENSATION PROGRAMS (OWCP)"
.AddItem " KE - FURLOUGH"
.AddItem " KG - MILITARY FURLOUGH(LWOP) - CALLED TO ACTIVE DUTY"
.AddItem " LA - ANNUAL LEAVE"
.AddItem " LB - ADVANCED ANNUAL LEAVE"
.AddItem " LC - COURT LEAVE"
.AddItem " LG - ADVANCED SICK LEAVE"
.AddItem " LH - HOLIDAY LEAVE"
.AddItem " LM - MILITARY LEAVE"
.AddItem " LN - ADMINISTRATIVE LEAVE"
.AddItem " LS - SICK LEAVE"
.AddItem " LT - TRAUMATIC INJURY (CONTINUATION OF PAY (COP))"
.AddItem " LU - DAY OF INJURY"
.AddItem " ND - NIGHT DIFFERENTIAL (GS EMPLOYEE)"
.AddItem " OC - OVERTIME CALLBACK"
.AddItem " OS - OVERTIME SCHEDULED"
.AddItem " OU - OVERTIME UNSCHEDULED"
.AddItem " RG - REGULAR (GS EMPLOYEE)"
.AddItem " RF - REGULAR - FIRST SHIFT (FWS EMPLOYEE)"
.AddItem " RS - REGULAR - SECOND SHIFT (FWS EMPLOYEE)"
.AddItem " RT - REGULAR - THIRD SHIFT (FWS EMPLOYEE)"
.AddItem " RN - REGULAR - PAID NOT WORKED (FIREFIGHTER)"
.AddItem " RW - REGULAR - AGENCY TRAINING (FIREFIGHTER)"
End With