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

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
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>
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,218,515
Messages
6,142,917
Members
450,453
Latest member
spaudel

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