Formating to Percents in a UserForm

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
 
T

Tom Ogilvy

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
 
T

Todd Huttenstine

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





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top