View Single Post
  #4   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Wed, 1 Jun 2005 05:51:06 -0700, Romany
wrote:

Is it possible to change the size of the percentage sign that Excel inserts
in cells when the number in the cell is a percentage? If there are a lot of
percentages in a table, it is very difficult to read the numbers because the
percentage signs detract from the numbers. It would be good if there were a
way to get Excel to automatically insert the percentage sign in a smaller
font.


Not directly.

As far as I know, you can only change the size of particular characters in a
cell if the entry is a text string.

So if the original entry is the result of a formula giving 0.6523879 and
formatted as %, you would have to turn that into a text string with defined
formatting; for example 65.24% and then format the % sign into a smaller font.

You could still use this value in *certain* math equations, but it would not be
as precise as the original.

The above could be automated with a macro. For example, if your % data is
A1:A100, the following macro

reads the value;
formats it as a percent with two decimal places;
outputs the value as a text string in the adjacent column;
and makes the % sign in a small font.

You could do this on your original data, changing it in place, but you would
permanently lose precision and might have to change some of your formulas.

But this should give you some idea of what is possible.

To enter this, <alt-F11 opens the VB Editor.
Ensure your project is highlighted in the project explorer window, then
Insert/Module and copy/paste the code below into the window that opens.

To use this macro, <alt-F8 brings up the macro dialog box. Select
SmallPercent and Run.

Obviously, you may need to change the "src" range and you may want to change
the Offset parameters, as well as the "fmt" code.

===================================
Option Explicit

Sub SmallPerCent()
Dim c As Range, src As Range
Const fmt As String = "0.00%"
Dim out As String

Set src = Range("A1:A100")

For Each c In src
out = Format(c.Value, fmt)
With c.Offset(0, 1)
.NumberFormat = "@"
.HorizontalAlignment = xlRight
.Formula = CStr(out)
.Characters(Start:=Len(out), Length:=1).Font.Size = 6
End With
Next c
End Sub
==============================


--ron