Automated userform inputs to the spreadsheet

D

Dan

I am using a userform to input 17 different pieces of data into 17 textboxes/comboboxes. When the data has been input, and I presses a button, I want it to place this data into cells on my spreadsheet. The first piece of data in cell "B2", the second into "C2" and so on down the row. Each of the input boxes has a different name which I gave it to make it easier for me to keep track of, like "username" instead of "combobox1", etc. Is there an automated way of having it input the data into the correct cells?
 
R

Ron de Bruin

You can use this

Sheets("Sheet1").Range("B2").Value = Me.TextBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


Dan said:
I am using a userform to input 17 different pieces of data into 17 textboxes/comboboxes. When the data has been input, and I
presses a button, I want it to place this data into cells on my spreadsheet. The first piece of data in cell "B2", the second into
"C2" and so on down the row. Each of the input boxes has a different name which I gave it to make it easier for me to keep track of,
like "username" instead of "combobox1", etc. Is there an automated way of having it input the data into the correct cells?
 
T

Tom Ogilvy

No automatic way.

You have to write each value.

If you textboxes had less meaningful names, such as combobox1, you might be
able to shorten your code.

if iempty(Range("B2")) then
set rng = Range("B2")
elseif isempty(Range("B3")) then
set rng = Range("B3")
Else
set rng = Range("B2").End(xldown)(2)
End if
rng(1,1).Value = Control1.Text
rng(1,2).Value = Control2.Text
rng(1,3).Value = Control3.Text

replace control1 and so forth with your meaningful names.

--
Regards,
Tom Ogilvy
Dan said:
I am using a userform to input 17 different pieces of data into 17
textboxes/comboboxes. When the data has been input, and I presses a button,
I want it to place this data into cells on my spreadsheet. The first piece
of data in cell "B2", the second into "C2" and so on down the row. Each of
the input boxes has a different name which I gave it to make it easier for
me to keep track of, like "username" instead of "combobox1", etc. Is there
an automated way of having it input the data into the correct cells?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top