mbake16
05-24-2009, 11:18 AM
Hello:
I'm trying to count range cells where the formula in the cell does not return "". When using the following code, it counts all cells containing a formula regardless of the value returned.
Sub CountNonBlankCells()
Dim CellCount As Long
CellCount = Application.WorksheetFunction.CountIf(Sheet2.Range("a1:k1"), "<>""")
MsgBox CellCount, vbOKOnly
End Sub
If anyone knows how to count only cells where the formula returns something other than "" your help would be greatly appreciated!
An example of what I'm trying to do is attached for reference.
Thanks,
Matt
I'm trying to count range cells where the formula in the cell does not return "". When using the following code, it counts all cells containing a formula regardless of the value returned.
Sub CountNonBlankCells()
Dim CellCount As Long
CellCount = Application.WorksheetFunction.CountIf(Sheet2.Range("a1:k1"), "<>""")
MsgBox CellCount, vbOKOnly
End Sub
If anyone knows how to count only cells where the formula returns something other than "" your help would be greatly appreciated!
An example of what I'm trying to do is attached for reference.
Thanks,
Matt