Counting Bordered Cells
wrote in message
...
Complete VBA noob.
I have created a module in VBA and have tried the following to count cells
in a range on one sheet that have four sides bordered and have the count
results in a cell on another sheet.
Line style and color do not matter.
Another one, based on Claus' but could be a few times faster be faster with
a large range
Function CountBordersAround(rng As Range) As Long
Dim n As Long
Dim c As Range
n = rng.Count
For Each c In rng
For i = xlEdgeLeft To xlEdgeRight
If c.Borders(i).LineStyle = xlNone Then
n = n - 1
Exit For
End If
Next
Next
CountBordersAround = n
End Function
Regards,
Peter T
|