ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code to add rows to combobox (https://www.excelbanter.com/excel-programming/323523-code-add-rows-combobox.html)

JT[_2_]

code to add rows to combobox
 
My form has 6 text boxes for the user to enter data.
Whatever data is entered into the text boxes should be a
new line on a combo box.

The combo box has 12 columns. One for each text box and
one is blank between each column with data. (The extra
columns help line up the data with the labels I'm using as
Headings.)

I'm having trouble with (1) getting the data from the text
boxes into columns. The only success I've had is getting
all of the data going down in column 1 instead of across
row 1.

and (2) each time the users enter data in this form a
different number of lines will be added to the combobox.
I'm having trouble adding a 2nd, 3rd 4th, etc. lines to
the combobox.

Any suggestions or help with this coding would be great.
Thanks for the help........

Tom Ogilvy

code to add rows to combobox
 
Private Sub CommandButton1_Click()
with listbox1
.AddItem Textbox1.Value
for i = 1 to 5
.list(.listcount-1, i * 2 ) = _
me.controls("Textbox" & i + 1).Value
Next
End With
End Sub
--
Regards,
Tom Ogilvy

"JT" wrote in message
...
My form has 6 text boxes for the user to enter data.
Whatever data is entered into the text boxes should be a
new line on a combo box.

The combo box has 12 columns. One for each text box and
one is blank between each column with data. (The extra
columns help line up the data with the labels I'm using as
Headings.)

I'm having trouble with (1) getting the data from the text
boxes into columns. The only success I've had is getting
all of the data going down in column 1 instead of across
row 1.

and (2) each time the users enter data in this form a
different number of lines will be added to the combobox.
I'm having trouble adding a 2nd, 3rd 4th, etc. lines to
the combobox.

Any suggestions or help with this coding would be great.
Thanks for the help........




JT[_2_]

code to add rows to combobox
 
Tom........thanks for the help.......I'll give that a try
-----Original Message-----
Private Sub CommandButton1_Click()
with listbox1
.AddItem Textbox1.Value
for i = 1 to 5
.list(.listcount-1, i * 2 ) = _
me.controls("Textbox" & i + 1).Value
Next
End With
End Sub
--
Regards,
Tom Ogilvy

"JT" wrote in

message
...
My form has 6 text boxes for the user to enter data.
Whatever data is entered into the text boxes should be a
new line on a combo box.

The combo box has 12 columns. One for each text box and
one is blank between each column with data. (The extra
columns help line up the data with the labels I'm using

as
Headings.)

I'm having trouble with (1) getting the data from the

text
boxes into columns. The only success I've had is

getting
all of the data going down in column 1 instead of across
row 1.

and (2) each time the users enter data in this form a
different number of lines will be added to the combobox.
I'm having trouble adding a 2nd, 3rd 4th, etc. lines to
the combobox.

Any suggestions or help with this coding would be great.
Thanks for the help........



.



All times are GMT +1. The time now is 08:44 AM.

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