Userform Textbox writing to a cell

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

I am having trouble with using a textbox inside of a
userform and having the value entered into the textbox
transferred to a specific excel cell. I'm am new at this
programming, and purchased a great book on VBA in Excel.
However, the book seems to just skip this detail. Any
help would be appreciated, thanks.
Rich
 
Rich,

Worksheets("Sheet1").Range("A1").Value = TextBox1.Value

The above (when run) will copy whatever is in TextBox1 to
Sheet1, Cell A1 (modify to suit your needs).

Post back if you need more help with this.

John
 
Rich,

I'm confused by your code??
Is MealTanks the UserForm that your TextBox is on???
Or are you callin MealTanks from another UserForm??

If that's the case, place your MealTanks.Show command
after your Worksheets("Sheet1").Range("C25").Value =
TextBox1.Value command.

If it's a CommandButton on a Worksheet, calling MealTanks,
then you need a way to get whatever value is entered into TextBox1
back to the cell.
To do this, you could add a CommandButton to the UserForm
Code it as such:

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("C25").Value =TextBox1.Value
Unload MealTanks
End Sub

Post back if you have more questions on this.
(and give me a little bit more of a description of what you have
and what you're trying to do)

John
 
Back
Top