Accessing data from combo box from VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I set up VBA code to acccess data entered into a combo box on an Excel
spreadsheet. The code in the last line is not working and I can't seem to
locate the proper command in the Help:

Dim cmbComboBox1 As ComboBox
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Registration")
Set cmbComboBox1 = ws.ComboBox1
 
wrote:

i.e.

Dim cmbComboBox1 As Shape
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Registration")
Set cmbComboBox1 = ws.Shapes.Item("ComboBox1")
cmbComboBox1.OLEFormat.Object.ListFillRange = Range("A1:A10").Address
MsgBox "TopLeftCell" & cmbComboBox1.TopLeftCell.Address
..........
 
Back
Top