combo box list error

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
 
E

ernie

ok i solved my own problem. i use the .clear before .additem. thanks anyways
With cboUnit
.Clear
.AddItem "Office"
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top