E
ernie
Hi All,
I need help with this code. i need to be able to remove the combobox list
before i add a new one.
Private Sub ValidateUnit()
If Application.WorksheetFunction.Clean(Trim(cboStation)) = "" Then
Label143.Visible = False
Label144.Visible = False
cboUnit.Visible = False
Else
Label143.Visible = True
Label144.Visible = True
cboUnit.Visible = True
'specify unit list
Select Case Application.WorksheetFunction.Clean(Trim(cboStation))
Case "00R0"
With cboUnit
.AddItem "Warehousing"
.AddItem "Valuation"
End With
Case "00P0"
With cboUnit
.AddItem "Office"
.AddItem "Shed"
End With
Case "00CA"
With cboUnit
.AddItem "Office"
End With
Case "00MH"
With cboUnit
.AddItem "Office"
End With
Case "00AN"
With cboUnit
.AddItem "Office"
End With
Case Else
'Do Nothing
End Select
End If
End Sub
I tried adding the code below but i get this an error message "Compile
error: Argument not optional"
If cboUnit.Visible = True Then
With cboUnit
.RemoveItem.ListIndex
End With
End If
Thanks
I need help with this code. i need to be able to remove the combobox list
before i add a new one.
Private Sub ValidateUnit()
If Application.WorksheetFunction.Clean(Trim(cboStation)) = "" Then
Label143.Visible = False
Label144.Visible = False
cboUnit.Visible = False
Else
Label143.Visible = True
Label144.Visible = True
cboUnit.Visible = True
'specify unit list
Select Case Application.WorksheetFunction.Clean(Trim(cboStation))
Case "00R0"
With cboUnit
.AddItem "Warehousing"
.AddItem "Valuation"
End With
Case "00P0"
With cboUnit
.AddItem "Office"
.AddItem "Shed"
End With
Case "00CA"
With cboUnit
.AddItem "Office"
End With
Case "00MH"
With cboUnit
.AddItem "Office"
End With
Case "00AN"
With cboUnit
.AddItem "Office"
End With
Case Else
'Do Nothing
End Select
End If
End Sub
I tried adding the code below but i get this an error message "Compile
error: Argument not optional"
If cboUnit.Visible = True Then
With cboUnit
.RemoveItem.ListIndex
End With
End If
Thanks