W
whitehurst
What vba function can I use that checks criteria much like SUMIF o
COUNTIF uses? In other words, say you want to write COUNTIF that onl
includes visible cells...
Public Function CountVIf(rng As range, criteria As String)
Dim cell As range, cmd As String
For Each cell In rng
If cell.RowHeight <> 0 And cell.ColumnWidth <> 0 Then
cmd = "COUNTIF(" & cell.Address & ",""" & criteria & """)"
CountVIf = CountVIf + Evaluate(cmd)
End If
Next cell
End Function
How can I do this without having to rely on Evaluate("COUNTIF...."?
Thanks
COUNTIF uses? In other words, say you want to write COUNTIF that onl
includes visible cells...
Public Function CountVIf(rng As range, criteria As String)
Dim cell As range, cmd As String
For Each cell In rng
If cell.RowHeight <> 0 And cell.ColumnWidth <> 0 Then
cmd = "COUNTIF(" & cell.Address & ",""" & criteria & """)"
CountVIf = CountVIf + Evaluate(cmd)
End If
Next cell
End Function
How can I do this without having to rely on Evaluate("COUNTIF...."?
Thanks