ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform Textbox writing to a cell (https://www.excelbanter.com/excel-programming/272266-userform-textbox-writing-cell.html)

Rich[_12_]

Userform Textbox writing to a cell
 
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


John Wilson

Userform Textbox writing to a cell
 
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 wrote:

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



John Wilson

Userform Textbox writing to a cell
 
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

Rich wrote:

I really appreciate your help!!!
Thanks, that is what I had. It must be somthing else. I
have a command buttom posted in excel and this is its
code.

Private Sub CommandButton2_Click()
MealTanks.Show

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

End Sub

The continue button on the userform is using the hide
command. From what I understand if I use the unload
command the value in the cell will get erased.

It is still not writing to the cell??? Do I need more
code? Thanks!

-----Original Message-----
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 wrote:

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


.



John Wilson

Userform Textbox writing to a cell
 
rich,

Thanks a million. This help group is great!!!

I take it that means your problem is solved????
And, if so, you're quite welcome.

John

rich wrote:

Thanks a million. This help group is great!!!




All times are GMT +1. The time now is 02:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com