ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accessing data from combo box from VBA (https://www.excelbanter.com/excel-programming/346074-accessing-data-combo-box-vba.html)

rmcompute

Accessing data from combo box from VBA
 
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

chijanzen

Accessing data from combo box from VBA
 
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
..........

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"rmcompute" wrote:

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


rmcompute

Accessing data from combo box from VBA
 
Thank you. Can you also indicate how to access the data inside the combo box ?

"chijanzen" wrote:

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
..........

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"rmcompute" wrote:

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



All times are GMT +1. The time now is 07:17 PM.

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