ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing item from combobox with vba (https://www.excelbanter.com/excel-programming/311310-removing-item-combobox-vba.html)

SOS[_35_]

Removing item from combobox with vba
 

Tom,

The comboboxes are populated during the UserForm_Initialize() event:

Private Sub UserForm_Initialize()
With comTeam1
.AddItem "Airdrie"
.AddItem "West Lothian"
End With - (many more teams in the real sheet)

With comTeam2
.AddItem "Airdrie"
.AddItem "West Lothian"
End With - (many more teams in the real sheet)
End Sub

So I felt that during the code I could use something like:

"comTeam2.RemoveItem comTeam1"

Thanks

Seamu

--
SO
-----------------------------------------------------------------------
SOS's Profile: http://www.excelforum.com/member.php...nfo&userid=540
View this thread: http://www.excelforum.com/showthread.php?threadid=26314


Tom Ogilvy

Removing item from combobox with vba
 
You can, but removeitem requires an index

comTeam2.RemoveItem comTeam1.ListIndex

--
Regards,
Tom Ogilvy


"SOS" wrote in message
...

Tom,

The comboboxes are populated during the UserForm_Initialize() event:

Private Sub UserForm_Initialize()
With comTeam1
AddItem "Airdrie"
AddItem "West Lothian"
End With - (many more teams in the real sheet)

With comTeam2
AddItem "Airdrie"
AddItem "West Lothian"
End With - (many more teams in the real sheet)
End Sub

So I felt that during the code I could use something like:

"comTeam2.RemoveItem comTeam1"

Thanks

Seamus


--
SOS
------------------------------------------------------------------------
SOS's Profile:

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





All times are GMT +1. The time now is 12:10 AM.

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