Font Information for a cell with multiple color and size

G

Guest

I have a range of cells J4:J404 that contain Strings of data. The default
font properties for this range are: font.Name: "Arial", Font.Size: 10.

There are cells containing highlighted data. Example: Cell J10 contains
the string "Cell with non standard font". The word "non" is highlighted with
a font.name="Bookman" and a font.size=14.

How do I know that a cell contains such highlighted text and what is the
property of this text? Do I have to go through the content of the cell
character by character?
 
J

Jim Cone

A cell with a mixed font size or mixed font will return null.
You can check for that to identify those cells.
'--
Sub WhatsThere()
Dim rCell As Range
Set rCell = ActiveCell
If IsNull(rCell.Font.Size) Then
MsgBox "Cell " & rCell.Address & " has more than one font size. "
End If
If IsNull(rCell.Font.Name) Then
MsgBox "Cell " & rCell.Address & " has multiple fonts. "
End If
End Sub
'--
If you want to know the details then you will have to interrogate
each character...
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel add-ins for sorting, comparing, counting and...)


"Pred"
<[email protected]>
wrote in message
I have a range of cells J4:J404 that contain Strings of data. The default
font properties for this range are: font.Name: "Arial", Font.Size: 10.

There are cells containing highlighted data. Example: Cell J10 contains
the string "Cell with non standard font". The word "non" is highlighted with
a font.name="Bookman" and a font.size=14.

How do I know that a cell contains such highlighted text and what is the
property of this text? Do I have to go through the content of the cell
character by character?
 

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