Problem with formatting in Userform TOTAL textbox

03856me

Active Member
Joined
Apr 4, 2008
Messages
297
I have a userform that totals two input boxes which are formatting with no problem to include the commas. I have searched your site for help with this and could only find formatting of individual textboxes and not one that is totaled.

Example of problem:
1,000,000 value of txt_hem
2,000,000 value of txt_fir
3 value of txt_total

I am including my code, can someone help me figure out why the total is not formatting as 3,000,000

thank you so much,

"Exhausted and confused"

'============================================================
'MACROS TO TOTAL INVENTORY
'============================================================
Private Sub InventoryTotal()
Dim InventoryTotal As Double
InventoryTotal = Val(Me.txt_hem) + Val(Me.txt_fir)

Me.txt_total = InventoryTotal
End Sub

Private Sub txt_hem_Change()
InventoryTotal
End Sub

Private Sub txt_fir_Change()
InventoryTotal
End Sub

'============================================================
'MACROS TO FORMAT TEXTBOXES
'============================================================
Private Sub txt_hem_AfterUpdate()
txt_hem.Value = Format(txt_hem.Value, "#,###,###")
End Sub

Private Sub txt_fir_AfterUpdate()
txt_fir.Value = Format(txt_fir.Value, "#,###,###")
End Sub

Private Sub txt_total_AfterUpdate()
txt_total.Value = Format(txt_total.Value, "#,###,###")
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Looks fine to me, but try this change
Code:
Private Sub InventoryTotal()
Dim InventoryTotal As Double
Me.txt_total = Format(InventoryTotal, "#,###,###")
and comment out
Code:
'Private Sub txt_total_AfterUpdate()
'txt_total.Value = Format(txt_total.Value, "#,###,###")
'End Sub
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

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