![]() |
.additem
i have two combo boxes: cboCount1 and cboCount2.
i have a long list of same items added to the drop down list of both combo boxes. With cboCount1 .additem = "1" .additem = "2" .additem = "3" End With With cboCount2 .additem = "1" .additem = "2" .additem = "3" End With I need to make my codes as short and compressed as possible. I want to use the same list for both combo boxes but use a shortcut. How can i achieve this. thanks in advance |
.additem
Maybe you can just do one item by item and use that list for the second
combobox. Option Explicit Private Sub UserForm_Initialize() With Me.cboCount1 .AddItem "1" .AddItem "2" .AddItem "3" End With Me.cboCount2.List = Me.cboCount1.List End Sub Or just build one array and use it twice: Option Explicit Private Sub UserForm_Initialize() Dim myArr As Variant myArr = Array("1", "2", "3") Me.cboCount1.List = myArr Me.cboCount2.List = myArr End Sub ernie wrote: i have two combo boxes: cboCount1 and cboCount2. i have a long list of same items added to the drop down list of both combo boxes. With cboCount1 .additem = "1" .additem = "2" .additem = "3" End With With cboCount2 .additem = "1" .additem = "2" .additem = "3" End With I need to make my codes as short and compressed as possible. I want to use the same list for both combo boxes but use a shortcut. How can i achieve this. thanks in advance -- Dave Peterson |
All times are GMT +1. The time now is 11:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com