View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Conan Kelly Conan Kelly is offline
external usenet poster
 
Posts: 419
Default Userform Textbox to Worksheet Textbox

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").Tex tBox1.Text =
Me.TextBox1.Text

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

HTH,

Conan Kelly






"targante" wrote in message
...
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)]