format #

technix

Active Member
Joined
May 19, 2002
Messages
326
I have a textbox on a userform this is the code I used

Code:
Private Sub TextBox7_Afterupdate()
TextBox7 = Format(TextBox7.Value, "##.00%")
End Sub

Why when I enter 8.5 and leave the cell it shows 850.% rather than 8.50%?

Derrick
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
On 2002-08-31 23:57, technix wrote:
I have a textbox on a userform this is the code I used

Code:
Private Sub TextBox7_Afterupdate()
TextBox7 = Format(TextBox7.Value, "##.00%")
End Sub

Why when I enter 8.5 and leave the cell it shows 850.% rather than 8.50%?

Derrick

8.5 is 850%.....just change so that it divides by 100 so....

<pre/>
Private Sub TextBox7_Afterupdate()
'// Resume incase of 0%
On Error Resume Next
TextBox7 = Format(TextBox7.Value / 100, "##.00%")
End Sub
</pre>
 

eliW

Well-known Member
Joined
Mar 2, 2002
Messages
1,934
On 2002-08-31 23:57, technix wrote:
I have a textbox on a userform this is the code I used

Code:
Private Sub TextBox7_Afterupdate()
TextBox7 = Format(TextBox7.Value, "##.00%")
End Sub

Why when I enter 8.5 and leave the cell it shows 850.% rather than 8.50%?

Derrick
Hi Derrick,

Percantage format multiply the cell value by 100 and displays the result with % symbol. Therefore you have to input your value as a fraction eg 0.085, or change the format.

Eli
 

technix

Active Member
Joined
May 19, 2002
Messages
326
Thank you I didnt even think of that, Ivans /100 is what was needed

Derrick
 

Forum statistics

Threads
1,144,358
Messages
5,723,891
Members
422,524
Latest member
wirkkarn

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
Top