View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default VBA currency or percent format object

It's going to be something like this:

Private Sub UserForm_Click()
If TextBox1.Text < "" Then
TextBox1.Text = Format(CDbl(TextBox1.Text), "$#,##0.00")
End If


If TextBox1.Text < "" Then
TextBox1.Text = Format(CVar(TextBox1.Text), "##0.00%")
End If
On Error Resume Next
End Sub

HTH,
Ryan

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"cwsimmons" wrote:

I have created a UserForm in VBA and would like users to enter currency and
percent values and see them formated as such. I can find only the TextBox
object in the Toolbox, which does not display inputs in the desired format.
Is there an object somewhere that automatically formats user inputs as
currency or percents?