Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Combo Box population question

Status
Not open for further replies.

SeeWard

Programmer
Mar 21, 2005
89
0
0
US
Hello,
I have created a userform in Excel and would like to have one combo box/drop down list be populated with data from 3 columns. Columns A B and E ...is there a way I can concatenate the columns so that they will not only appear in the drop down but also be saved to the excel sheet. I am creating an inventory application that will utilize this info.
 
SeeWard,

As an idea:

In the sheet:
Put some values in A1,A2,B1,B2,E1,E2


In the UserForm:
Option Explicit

Private Sub CommandButton1_Click()
Range("A3").Value = Split(ComboBox1.List(0), ",")(0)
Range("B3").Value = Split(ComboBox1.List(0), ",")(1)
Range("E3").Value = Split(ComboBox1.List(0), ",")(2)

Range("A4").Value = Split(ComboBox1.List(1), ",")(0)
Range("B4").Value = Split(ComboBox1.List(1), ",")(1)
Range("E4").Value = Split(ComboBox1.List(1), ",")(2)


End Sub

Private Sub UserForm_Activate()
ComboBox1.AddItem Range("A1").Value & "," & Range("B1").Value & "," & Range("E1").Value
ComboBox1.AddItem Range("A2").Value & "," & Range("B2").Value & "," & Range("E2").Value
End Sub

vladk
 
Ok...that does make sense and I really appreciate the time you took to jot that down...I have a tricky aspect though...I wonder if I can make that range grow if a new product is added. It's an inventory system, and they might get a new product in so a set range might prove troublesome in that area...THOUGH it's a helluva good start..so THANK YOU!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top