ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I detect if the text in a cell is underlined? (https://www.excelbanter.com/excel-programming/359788-how-can-i-detect-if-text-cell-underlined.html)

plh

How can I detect if the text in a cell is underlined?
 
Hello all,
I need to detect if the text in a given cell is underlined or not.
I tried:
If Sheets("Parts List").Cells(TITLEROW, intC).Underline = xlUnderlineStyleSingle
Then
But I get:
"Object doesn't support this property or method"
same with:
If Sheets("Parts List").Cells(TITLEROW, intC).Underline.xlUnderlineStyleSingle =
True Then
I have to admit, at this point I am guessing.
Does anyone know the right way to do this?
Thank You,
-plh


--
I keep hitting "Esc" -- but I'm still here!

Jim Cone

How can I detect if the text in a cell is underlined?
 
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Function AnySupport(ByRef rngCells As Excel.Range) As Variant
Dim varUL As Variant
varUL = (rngCells.Font.Underline < xlUnderlineStyleNone)
If IsNull(varUL) Then
AnySupport = "Some cells are underlined "
Else
AnySupport = varUL
End If
Set rngCells = Nothing
End Function

Sub FindOut()
MsgBox AnySupport(Excel.Selection), , " Underlined Font ?"
End Sub
'------------



"plh"
wrote in message
Hello all,
I need to detect if the text in a given cell is underlined or not.
I tried:
If Sheets("Parts List").Cells(TITLEROW, intC).Underline = xlUnderlineStyleSingle
Then
But I get:
"Object doesn't support this property or method"
same with:
If Sheets("Parts List").Cells(TITLEROW, intC).Underline.xlUnderlineStyleSingle =
True Then
I have to admit, at this point I am guessing.
Does anyone know the right way to do this?
Thank You,
-plh
--
I keep hitting "Esc" -- but I'm still here!

plh

How can I detect if the text in a cell is underlined?
 
Thank You!
-plh
In article , Jim Cone says...

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Function AnySupport(ByRef rngCells As Excel.Range) As Variant
Dim varUL As Variant
varUL = (rngCells.Font.Underline < xlUnderlineStyleNone)
If IsNull(varUL) Then
AnySupport = "Some cells are underlined "
Else
AnySupport = varUL
End If
Set rngCells = Nothing
End Function

Sub FindOut()
MsgBox AnySupport(Excel.Selection), , " Underlined Font ?"
End Sub
'------------



"plh"
wrote in message
Hello all,
I need to detect if the text in a given cell is underlined or not.
I tried:
If Sheets("Parts List").Cells(TITLEROW, intC).Underline = xlUnderlineStyleSingle
Then
But I get:
"Object doesn't support this property or method"
same with:
If Sheets("Parts List").Cells(TITLEROW, intC).Underline.xlUnderlineStyleSingle =
True Then
I have to admit, at this point I am guessing.
Does anyone know the right way to do this?
Thank You,
-plh



--
I keep hitting "Esc" -- but I'm still here!


All times are GMT +1. The time now is 05:47 PM.

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