Formating to Percents in a UserForm

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

I have the following code. In cell AA1:AA4 there are
numbers. For instance the number in cell AA1 is .35. The
code pulls the value from the specified cells and displays
it in the cooresponding textbox. When the userform is
loaded, the text boxes display the numbers in .XX
format..... for example Textbox1 displays .35. I would
like for the textboxes to show the numbers in percent
format. For example I would like textbox1 to show 35%
instead of .35. What is the code for this?

Private Sub UserForm_Initialize()
Me.TextBox1.Value = Worksheets(1).Range("AA1").Value
Me.TextBox2.Value = Worksheets(1).Range("AA2").Value
Me.TextBox3.Value = Worksheets(1).Range("AA3").Value
Me.TextBox4.Value = Worksheets(1).Range("AA4").Value
End Sub





Thanks in advance to all who reply.

Todd Huttenstine
 
Private Sub UserForm_Initialize()
Me.TextBox1.Value = Format(Worksheets(1).Range("AA1").Value,"0%")
Me.TextBox2.Value = Format(Worksheets(1).Range("AA2").Value,"0%")
Me.TextBox3.Value = Format(Worksheets(1).Range("AA3").Value,"0%")
Me.TextBox4.Value = Format(Worksheets(1).Range("AA4").Value,"0%")
End Sub
 
Thank you thats worked great!

-----Original Message-----
Private Sub UserForm_Initialize()
Me.TextBox1.Value = Format(Worksheets(1).Range ("AA1").Value,"0%")
Me.TextBox2.Value = Format(Worksheets(1).Range ("AA2").Value,"0%")
Me.TextBox3.Value = Format(Worksheets(1).Range ("AA3").Value,"0%")
Me.TextBox4.Value = Format(Worksheets(1).Range ("AA4").Value,"0%")
End Sub

--
Regards,
Tom Ogilvy





.
 
Back
Top