count cells with diagonal borders

  • Thread starter Thread starter jt
  • Start date Start date
J

jt

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
 
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
 
Back
Top