0
我正在嘗試對高亮顯示的所有行進行計數(不隱藏)。我的計數公式有效,但它仍在計算隱藏的行,這些行也被隱藏起來。我怎樣才能只計算突出顯示和可見行?VBA:如何忽略範圍內的隱藏行?
'This function will count how many cells in a given range for a given color and are visible
Function COUNTCELLCOLORSIF(CellRange As Range) As Long
Dim rngCell
Application.Volatile
For Each rngCell In CellRange
If rngCell.Interior.ColorIndex = "36" and rngCell.visible Then
COUNTCELLCOLORSIF = COUNTCELLCOLORSIF + 1
End If
Next rngCell
End Function
檢查'rngCell.RowHeight'> 0 –
@simoco在小區i要計算formla,我會做「= COUNTCELLCOLORSIF(A1:A10)」 – thedeepfield
@TimWilliams,謝謝你做到了! – thedeepfield