View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
lifescholar lifescholar is offline
external usenet poster
 
Posts: 7
Default count cells with diagonal borders

On Sep 11, 4:00*am, jt wrote:
i wish to count cells in a range that have diagonal cell borders or
the cell is X'd out, is it possible, thanks for any help


Try the following UDF:

Function CountDiagonal(rng As Range)

Dim i As Integer
Dim cell As Range

i = 0

For Each cell In rng
If cell.Borders(xlDiagonalDown).LineStyle < xlLineStyleNone _
Or cell.Borders(xlDiagonalUp).LineStyle < xlLineStyleNone
Then
i = i + 1
End If
Next

CountDiagonal = i

End Function