count cells with diagonal borders

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
 
L

lifescholar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top