ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detecting Null (https://www.excelbanter.com/excel-programming/372550-detecting-null.html)

Zone

Detecting Null
 
I want to detect whether part of the text in a cell is bolded,
underlined, or uses a special font. Rather than slow things down by
looking at each character, I thought I could just detect whether any
part of the text in the cell has one of these attributes since, if only
part of a cell is bold, for instance, the fontstyle for the whole cell
will be null. However, looking at a cell with only part of it bolded
and part of it underlined, I can't seem to detect this with something
like this:
with activecell.font
If IsNull(.Name) Or IsNull(.FontStyle) Or IsNull(.Underline) Or
IsNull(.Bold) Then DetectJ = True
end with

What am I doing wrong? Excel 2002. TIA, James


Tom Ogilvy

Detecting Null
 
Seemed to work for me. At least it worked as I expected.

--
Regards,
Tom Ogilvy


"Zone" wrote in message
ups.com...
I want to detect whether part of the text in a cell is bolded,
underlined, or uses a special font. Rather than slow things down by
looking at each character, I thought I could just detect whether any
part of the text in the cell has one of these attributes since, if only
part of a cell is bold, for instance, the fontstyle for the whole cell
will be null. However, looking at a cell with only part of it bolded
and part of it underlined, I can't seem to detect this with something
like this:
with activecell.font
If IsNull(.Name) Or IsNull(.FontStyle) Or IsNull(.Underline) Or
IsNull(.Bold) Then DetectJ = True
end with

What am I doing wrong? Excel 2002. TIA, James




Zone

Detecting Null
 
Thanks, Tom. Yes, it does work fine. I checked again and I didn't
have the cell address correct. I appreciate your answer. Forced me to
find the mistake. This way is much faster than looking at each
character. Regards, James

Tom Ogilvy wrote:
Seemed to work for me. At least it worked as I expected.

--
Regards,
Tom Ogilvy


"Zone" wrote in message
ups.com...
I want to detect whether part of the text in a cell is bolded,
underlined, or uses a special font. Rather than slow things down by
looking at each character, I thought I could just detect whether any
part of the text in the cell has one of these attributes since, if only
part of a cell is bold, for instance, the fontstyle for the whole cell
will be null. However, looking at a cell with only part of it bolded
and part of it underlined, I can't seem to detect this with something
like this:
with activecell.font
If IsNull(.Name) Or IsNull(.FontStyle) Or IsNull(.Underline) Or
IsNull(.Bold) Then DetectJ = True
end with

What am I doing wrong? Excel 2002. TIA, James




All times are GMT +1. The time now is 08:40 AM.

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