format user form text box

Tony Miall

Active Member
Joined
Oct 16, 2007
Messages
304
Hi,

I have a text box on a user form that displays a value of a cell. I want the text box to display the value in a $ format.

I have tried

Code:
Private Sub InvoiceDifference_AfterUpdate()
    With Me.InvoiceDifference
        .Value = FORMAT(.Value, "$#,###.00")
    End With
End Sub

and a few other variations with no luck, the value displays as 123.654854746 instead of $123.65

Any help appreciated as usual.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Tony

Where is the value in the textbox coming from?

If I type that in it's formatted as you want.
 
Upvote 0
Thanks for the reply Norrie.

A formula works out the value of the active cell then the following code fills the text box.

Code:
    InvoiceDetail.InvoiceDifference.Value = ActiveCell

Hope that's clear. Maybe I'm not going about this the right way?
 
Upvote 0
Tony

Is the cell displaying the correct formatting?

If it is try using ActiveCell.Text when you put the value in the texbox.

That should carry over the formatting from the worksheet.

By the way, are you sure the AfterUpdate was even getting executed?

I'm pretty sure just putting a value in a textbox won't trigger it.
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

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