Reputation: 3041
I have a Combobox in my Spreadsheet. I am trying to get the selected value from it. But not been able to do so.
These are the Codes that I tried:
Range("A1")=ComboBox1.SelectedItem
And
Range("A1")=ComboBox1.Value
Kindly help me with this. They both are not working.
This is how I added the Items to the Combobox:
For i = 2 To lastnum
disName= ThisWorkbook.Sheets(final).Range(Col& i).Value
With wb21Tool.Sheets("Main").ComboBox1
.AddItem disName
End With
Next
Upvotes: 0
Views: 687
Reputation: 33692
You need to fully qualify your objects, try:
wb21Tool.Sheets("Main").Range("A1").Value = wb21Tool.Sheets("Main").ComboBox1.Value
Or,
With wb21Tool.Sheets("Main")
.Range("A1").Value = .ComboBox1.Value
End With
Upvotes: 3