Formatting a Userform TextBox As Currency...

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
884
Office Version
  1. 365
Platform
  1. Windows
Is there an easy way to format a UserForm that contains many Textboxes ALL as Currency? THe values can be
Code:
$#.##, $##.##, $###.## or $#,###.##.
Is there an easy way to do this without having to type a lot of code for each textbox.

Remark: I am surprised that there is no property item that would allow the setting of formats for a textbox from a drop down list box.

Thank you for ANYONE's help.

CR
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
CR

You could try something like this.
Code:
For Each ctl In Me.Controls
       If TypeName(ctl) = "TextBox" Then
            ctl.Value = Format(ctl.Value, "$#.##")
       End If
Next ctl
Comment:

Why are you surprised?

Excel deals with numbers, as soon as you use something like Format you end up with text.

Then if you want to use the values in calculations you need to convert them from text to numbers.:)
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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