ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vba excel - Combo box question - erasing value (https://www.excelbanter.com/excel-programming/315533-vba-excel-combo-box-question-erasing-value.html)

ajliaks[_43_]

Vba excel - Combo box question - erasing value
 

Hi all,

I have a combo box full of data. One of the data is "<New Item".
want to locate, and erase that value from the list.
I am trying the code below, but getting sintax error.
Can anybody help? Thanks in advance, Aldo.

For c1 = 0 To ComboBox.ListCount
If ComboBox.Value(c1) = "<New Item" Then
ComboBox(c1).clear
exit for
End If
Next c

--
ajliak
-----------------------------------------------------------------------
ajliaks's Profile: http://www.excelforum.com/member.php...nfo&userid=819
View this thread: http://www.excelforum.com/showthread.php?threadid=27450


Tom Ogilvy

Vba excel - Combo box question - erasing value
 
For c1 = 0 To ComboBox.ListCount - 1
If Instr(1,ComboBox.List(c1) ,"<New Item",vbTextcompare) Then
ComboBox.RemoveItem c1
exit for
End If
Next c1

--
Regards,
Tom Ogilvy

"ajliaks" wrote in message
...

Hi all,

I have a combo box full of data. One of the data is "<New Item". I
want to locate, and erase that value from the list.
I am trying the code below, but getting sintax error.
Can anybody help? Thanks in advance, Aldo.

For c1 = 0 To ComboBox.ListCount
If ComboBox.Value(c1) = "<New Item" Then
ComboBox(c1).clear
exit for
End If
Next c1


--
ajliaks
------------------------------------------------------------------------
ajliaks's Profile:

http://www.excelforum.com/member.php...fo&userid=8196
View this thread: http://www.excelforum.com/showthread...hreadid=274501





All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com