ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with populating new combobox with list of ranges (https://www.excelbanter.com/excel-programming/375857-help-populating-new-combobox-list-ranges.html)

Chris

Help with populating new combobox with list of ranges
 
I need to populate a new combobox with a list of ranges. I have one
combobox that works with one range "Main" but I have 4 other ranges on
the worksheet that I need to inlcude. So for example, I will choose the
range "Main" with one combobox and the data from the rowsources will
show up on the userform text box part. Is there a simple way to add a
second combobox for the additional ranges ? Here is my current code
below: Assuming I can get some guidance, I will be creating a second
combobox for the ranges.. thanks for any help..

Private Sub ComboBox1_Change()
'If we're initialize then all txt boxes are blank, don't write
If Not Initialize Then
SaveRow
End If

'Set current row
lCurrentRow = ComboBox1.ListIndex + 6

'LoadRow based off new current row
LoadRow
'Load TextBoxes
Set rng = Range(Range("Main").Offset(3), _
Range("Main").Offset(3).End(xlDown))
'Range(ComboBox1.RowSource)
txtReqNum.Text = rng(ComboBox1.ListIndex + 1)(1, 1)
txtDateOpen.Text = rng(ComboBox1.ListIndex + 1)(1, 2)
txtType.Text = rng(ComboBox1.ListIndex + 1)(1, 4)
txtPriority.Text = rng(ComboBox1.ListIndex + 1)(1, 5)
txtTitle.Text = rng(ComboBox1.ListIndex + 1)(1, 6)
txtGrd.Text = rng(ComboBox1.ListIndex + 1)(1, 7)
txtExpected.Text = rng(ComboBox1.ListIndex + 1)(1, 10)
txtNR.Text = rng(ComboBox1.ListIndex + 1)(1, 11)
txtManager.Text = rng(ComboBox1.ListIndex + 1)(1, 12)
txtDept.Text = rng(ComboBox1.ListIndex + 1)(1, 13)
txtRecr.Text = rng(ComboBox1.ListIndex + 1)(1, 14)
txtStatus.Text = rng(ComboBox1.ListIndex + 1)(1, 15)
txtCandidate.Text = rng(ComboBox1.ListIndex + 1)(1, 16)
End Sub



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

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