Userform Textbox writing to a cell

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
 
J

John Wilson

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
 
J

John Wilson

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
 

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