![]() |
combo box list error
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(cboStatio n)) = "" 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(cboStatio n)) 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 |
combo box list error
ok i solved my own problem. i use the .clear before .additem. thanks anyways
With cboUnit .Clear .AddItem "Office" End With "ernie" wrote: 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(cboStatio n)) = "" 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(cboStatio n)) 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 |
All times are GMT +1. The time now is 12:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com