ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Font Information for a cell with multiple color and size (https://www.excelbanter.com/excel-programming/392314-font-information-cell-multiple-color-size.html)

Pred

Font Information for a cell with multiple color and size
 
I have a range of cells J4:J404 that contain Strings of data. The default
font properties for this range a 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?

Jim Cone

Font Information for a cell with multiple color and size
 

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"

wrote in message
I have a range of cells J4:J404 that contain Strings of data. The default
font properties for this range a 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?


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com