Hello All,
I am novice VBA user and would appreciate a better or maybe more efficient way to evaluate range and it's property. Any advise with code herein is helpfull. Routine here loop only through 160 rows for my worksheet but is still very slow!!!
I am novice VBA user and would appreciate a better or maybe more efficient way to evaluate range and it's property. Any advise with code herein is helpfull. Routine here loop only through 160 rows for my worksheet but is still very slow!!!
Code:
Sub Routine()
Dim r As Integer
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
r = 6
Do Until Cells(r, 3) = ""
If Rows(r).EntireRow.Hidden = False Then
If CountCM(Range("$A$" & r, "$DA$" & r)) = 0 Then
Rows(r).EntireRow.Hidden = True
End If
End If
r = r + 1
Loop
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Function CountCM(ByVal rng As Range)
CountCM = 0
For Each cell In rng
If cell.Borders(xlDiagonalUp).LineStyle <> xlLineStyleNone Then
CountCM = CountCM + 1
End If
Next
End Function