Formatting Question

S

Scott

I've got a cell that's linked to two other cells which
are percentages, and I want my cell to show each of them
at 3 decimals. Ex. 6.000%/7.125%, where it links to one
cell who's value is 6% and another who's value is 7.125%.
The only way I can do it now it shows UP TO three
decimals, but shortens it if there are zeros. So the
above example would display as 6%/7.125% Any ideas?
Thanks in advance,
Scott
 
F

Frank Kabel

Hi Scott
try
=TEXT(A1,"0.000%") & "/" & TEXT(A2,"0.000%")
where A1 and A2 store your two percent values

Frank
 
G

Guest

Thanks Franks, that worked perfectly.

Now, what it I want the first one to be bolded, but not
the second?

Scott
 
S

Scott

That's odd. If you've only got text in a cell, you're
able to have part of it bold, and part of it not. How
about if I already had the source cells formatted how I
want, ex one bolded, the other not, is there a way to
preserve the original format of each?
Scott
 
F

Frank Kabel

Scott said:
That's odd. If you've only got text in a cell, you're
able to have part of it bold, and part of it not. How
about if I already had the source cells formatted how I
want, ex one bolded, the other not, is there a way to
preserve the original format of each?
Scott

Hi Scott
unfortunately Excel's formulas (as well s UDFs) only return values.
They will also not copy the source format. The only way to achieve this
would be using the worksheet_change event, checking the values in your
cells and doing the formatting by code.

Frank
 
S

Scott

Frank,
I have no idea what that means. Sorry, but could you give
an example?
Scott
 
F

Frank Kabel

Scott said:
Frank,
I have no idea what that means. Sorry, but could you give
an example?
Scott

Hi Scott
to give you an idea: Put the following code in your worksheet module.
It will check if cell A1 is not empty and will format the first 4
characters as bold and charatcers 5-8 as italic

Frank

-----
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp:
With Target
If .Value <> "" Then
Application.EnableEvents = False
.Font.Bold = False
.Font.Italic = False
.Characters(1, 4).Font.Bold = True
.Characters(5, 4).Font.Italic = True
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub
 
S

Scott

Yikes, I don't know anything about modules. Is that the
same as macros? I'm trying to avoid those if at all
possible.

Scott
 

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