View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default UDF - detect cell border



Function Isborder(cell As Range) as Boolean
Dim bTop As Boolean, bBottom As Boolean
Application.Volatile
bTop = True
bBottom = True
With cell.Borders(xlEdgeTop)
If .Weight = 2 And .LineStyle = -4142 _
And .ColorIndex = -4142 Then
bTop = False
End If
End With
With cell.Borders(xlEdgeBottom)
If .Weight = 2 And .LineStyle = -4142 _
And .ColorIndex = -4142 Then
bBottom = False
End If
End With
Isborder = bTop Or bBottom
End Function

--
Regards,
Tom Ogilvy


"Jason Morin" wrote in message
...
I'm struggling with a simple UDF (it might require 2). I'd
like to return TRUE/FALSE if a cell has a top *or* bottom
border. Something like:

Function IsBorder(cell As Range) As Boolean
IsBorder = cell.Borders(xlEdgeTop)
End Function

Thanks!
Jason