Userform Textbox to Worksheet Textbox

T

targante

I have a userform textbox that I want to transfer the user-entered data from
into a VBA textbox on a worksheet (Excel 2003).
Psuedo Code:
Userform loads
User enters data into userform's textbox
User clicks "Ok" on the userform
Userform opens workbook
Userform transfers data from its textbox to the textbox on the worksheet
How do I reference the textbox on the worksheet (its name is "CRDetails")?
TIA,
Trent Argante
[DC.J(166)]
 
C

Conan Kelly

Trent,

Since you say:
Userform loads ...
Userform opens workbook

I think it is safe to assume that the user form is in a different workbook
than the one you are opening. Will the workbook that opens be the same one
every time?

Here is a little code that I just whipped up that hides the form, then
transfers text typed into the form's text box to the sheet's text box when
the button is clicked. My text box on the work sheet and the one on the
form are both named "TextBox1". Change your code accordingly.


Private Sub CommandButton1_Click()
Me.Hide
Worksheets("Sheet1").TextBox1.Text = Me.TextBox1.Text
End Sub


You will probably have to qualify sheet's text box part of the statement
with the workbook as well. So...

Worksheets("Sheet1").TextBox1.Text = Me.TextBox1.Text

....will become something like this...

Workbooks("PERSONAL.XLS").Worksheets("Sheet1").TextBox1.Text =
Me.TextBox1.Text

Change the workbook name, worksheet name, and text box names accordingly.

HTH,

Conan Kelly






targante said:
I have a userform textbox that I want to transfer the user-entered data
from
into a VBA textbox on a worksheet (Excel 2003).
Psuedo Code:
Userform loads
User enters data into userform's textbox
User clicks "Ok" on the userform
Userform opens workbook
Userform transfers data from its textbox to the textbox on the worksheet
How do I reference the textbox on the worksheet (its name is "CRDetails")?
TIA,
Trent Argante
[DC.J(166)]
 

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