View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default 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!