Update UserForm Data in TextBox's w/o Closing UserForm

taraus88

New Member
Joined
Apr 8, 2006
Messages
18
I currently have a UserForm which has 5 TextBox's and 1 CommandButton2 (Enter Button). I've written a code that will allow me to enter a dollar amount into TextBox8. After hitting the CommandButton2, it then sends the dollar amount data to the Worksheet in Cell C39. There are dollars amounts in Cell C49 and G49 which are calculated from Cell C39. I would like for TextBox9 and 10 to reflect the updated data from the Cells, in TextBox 9 and 10 without the UserForm closing. The current code that I am using is as:

_________________________________________________________________
Private Sub CommandButton2_Click()
Dim LastRow As Range
Dim Response As Integer
Set LastRow = Worksheets("TTL VS. TTP Calculator").Range("C39")
LastRow.Offset(0, 0).Value = TextBox8.Text
TextBox8.Text = ""
End Sub
_________________________________________________________________

I also had to format the TextBox's to show the dollar amount reflected below.

Private Sub TextBox9_AfterUpdate()
TextBox9.Text = Format(TextBox9.Text, "$#,##0.00")
End Sub

Private Sub TextBox10_AfterUpdate()
TextBox10.Text = Format(TextBox10.Text, "$#,##0.00")
End Sub
_________________________________________________________________

And last, i have a code to initalize the UserForm

Private Sub UserForm_Initialize()
TextBox9.Text = Worksheets("TTL VS. TTP Calculator").Range("C49").Text
TextBox10.Text = Worksheets("TTL VS. TTP Calculator").Range("G49").Text
End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Can't you just add:

TextBox9.Text = Worksheets("TTL VS. TTP Calculator").Range("C49").Text
TextBox10.Text = Worksheets("TTL VS. TTP Calculator").Range("G49").Text

to the end of your CommandButton2_Click() code?
 
Upvote 0
I apologize doofusboy. That did work actually. Forgot to put End Sub to close code. I'm incompetent today....LOl. Thanks alot for your help. I'm rolling now.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top