Userform / textbox data to sheet example request.

dbmathis

Well-known Member
Joined
Sep 22, 2002
Messages
1,064
Hi all,

I have created a userform (transEntry) and I am seeking an example of taking the data that has been entered into a textbox on the userform and copying it into a cell on my sheet.

The Submit button on the userforn is: CommandButton1
An example text box is: TextBox2

What I am hoping I can get to happen is there will be text in TextBox2 and when someone clicks the Submit button (CommandButton1), the text in TextBox2 is copied to some cell on my sheet1 (Ex: M17).

Then after the submit button has been pushed and the data copied, then the userform (transEntry) is cleared out.

Would someone mind creating an example for me?

Thanks
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,059
Office Version
  1. 365
Platform
  1. Windows
Something like this perhaps.
Code:
Private Sub CommandButton1_Click()
    Range("M17").Value = Textbox2.Text
    Textbox2.Text = ""
End Sub
 

dbmathis

Well-known Member
Joined
Sep 22, 2002
Messages
1,064
This question is related to this thread so I will ask it here.

Consider that there is a column of data, I2 thru I212, and cells I2 thru I100 contain data.

Rather than posting the data for Textbox2 into a static cell like M17. How would I modify Norie's VBA to start in cell I212 and search upward until a cell with data in it's found (in this example: I100) and then paste the data that's in Textbox2 six cell to the left of it (which would be in this example C100)?
 

Watch MrExcel Video

Forum statistics

Threads
1,118,530
Messages
5,572,697
Members
412,481
Latest member
nhantam
Top