Transferring data from a user form

WoodyMark

New Member
Joined
Dec 17, 2018
Messages
3
Hi, I've created a userform with text boxes and check boxes but struggling to work out how to get the data transferred onto a spreadsheet via a submit button.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Am no VBA expert, but isn't it something like this?

Go into design mode, design your form, lets say Text Box and a Button
Right click the button select View Code

You should see

Code:
Private Sub CommandButton1_Click()

End Sub

in the sub enter

Code:
Range("A1") = TextBox1

Come out of Design mode, enter some text in the text box.
Click the button
You should see the value in the text box in cell A1
 
Upvote 0
Welcome to the forum. Behind the command button you can add something like this:

Sheets("Sheet to goto please change the name here").Activate
Range("The cell").Value = Me.TextBoxName.Value
Range("The Next Cell")=Me.TextBoxName2.Value
And so on
Me.Hide

If you want the data to be added to new row you will have to be more specific in your thread.
 
Upvote 0
Welcome to the forum.

Do the values always go to the same cells, or is this like a data entry form where you add row after row?
 
Upvote 0
Hi, how would I get the data added to a new row each time? thanks.

Welcome to the forum. Behind the command button you can add something like this:

Sheets("Sheet to goto please change the name here").Activate
Range("The cell").Value = Me.TextBoxName.Value
Range("The Next Cell")=Me.TextBoxName2.Value
And so on
Me.Hide

If you want the data to be added to new row you will have to be more specific in your thread.
 
Upvote 0
You'd do something like this:

Code:
With Sheets("sheet name here")
Dim NextRow as long
NextRow = .Cells(.Rows.count, "A").End(xlUp).Row + 1
.Cells(nextrow, "A").Value = me.textbox1.text
.cells(nextrow, "B").value = me.textbox2.text
' etc.
end with
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,753
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top