ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do I reference data from a Combo Box? (https://www.excelbanter.com/excel-programming/357710-how-do-i-reference-data-combo-box.html)

Rick

how do I reference data from a Combo Box?
 
I'm very new to this. So please bare with me:

I created three combo boxs, each with several entries in it. I woulld like
a command button to be used to read these entries to fill out a table. I
then would like to reference this table.

In a nut shell it is going to be an order form for customers to fill out so
that I can process their selected size, collors and quantities of the widgets
I'm selling.

Thanks

Tom Ogilvy

how do I reference data from a Combo Box?
 
Private Sub CommandButton1_Click()
with worksheets("Data")
.Range("A1").Value = Combobox1.Value
.Range("A2").Value = Combobox2.Value
.Range("A3").Value = Combobox3.Value
end With
End sub

Assumes comboboxes from the control toolbox toolbar one either a worksheet
(code must be in the sheet module)
or a Userform
(code must be in the userform module)

You can always reference the cells to get the information.

--
Regards,
Tom Ogilvy



"Rick" wrote:

I'm very new to this. So please bare with me:

I created three combo boxs, each with several entries in it. I woulld like
a command button to be used to read these entries to fill out a table. I
then would like to reference this table.

In a nut shell it is going to be an order form for customers to fill out so
that I can process their selected size, collors and quantities of the widgets
I'm selling.

Thanks


Rick

how do I reference data from a Combo Box?
 
Tom,

Thanks. That helped very much. But now I have another problem. I really
should be updating a table instead of a row of cells because every time the
user chooses from the list it updates the same cells. In other words the
user can continually choose from the drop down list and hit the command
button to "add to his basket". I could enter logic that would add '1' to the
next row but that is probably not the correct approach.

I tried to create a table but very time I select the cell range it says "The
selection is invalid". I then tried that Pivot Table (never heard of that)
and that also failed... in glorious fashion. It is very clear I have no idea
what the heck I'm doing.

But my form and combo boxes sure look nice!
"Tom Ogilvy" wrote:

Private Sub CommandButton1_Click()
with worksheets("Data")
.Range("A1").Value = Combobox1.Value
.Range("A2").Value = Combobox2.Value
.Range("A3").Value = Combobox3.Value
end With
End sub

Assumes comboboxes from the control toolbox toolbar one either a worksheet
(code must be in the sheet module)
or a Userform
(code must be in the userform module)

You can always reference the cells to get the information.

--
Regards,
Tom Ogilvy



"Rick" wrote:

I'm very new to this. So please bare with me:

I created three combo boxs, each with several entries in it. I woulld like
a command button to be used to read these entries to fill out a table. I
then would like to reference this table.

In a nut shell it is going to be an order form for customers to fill out so
that I can process their selected size, collors and quantities of the widgets
I'm selling.

Thanks



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

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