Reputation: 149
I have a combobox to a userform and the its not an activesheet in excel so not sure how to go about it.
The sheet name is "DoNotPrint - Rate Index" and the values within that sheet to appear in the combobox are the columns C2:AS2.
Private Sub ComboBox1_Change()
Sheets("DoNotPrint - Rate Index").Range("C2:AS2") = ComboBox1.Value
End Sub
I tried this code and the combobox list isn't populating those column when the combobox list button is clicked.
Upvotes: 0
Views: 185
Reputation: 929
The code you posted is for taking what's in the combobox and putting it on the sheet, when it's selected. But if I understand correctly your issue is you can't get the combobox populated. Because you are using a single row as your dataset and not a single column you will need to transpose your data.
Private Sub UserForm_Initialize()
ComboBox1.List = WorksheetFunction.Transpose(Sheet1.Range("C2:AS2"))
End Sub
Upvotes: 1