Hello ,
I try to count cells that are greater than 0 from a row where the columns are moving from hide to unhide. I need to ignore the hidden cells. Every solution that i use was not work. My cells that i need to count are from C25:L25.
I tried :
1. =COUNTIF(C25:L25,">0") -> not working because depends on a cell value i hide some columns.
2. =SUMPRODUCT(SUBTOTAL(103,OFFSET(C25:L25,ROW(C25:L25)-ROW(C25),,1)),--(C25:L25>0)) -> returns me only #value! (i don`t know why)
3. I have also a module -> doesn`t work because it count also if the cell is 0
Can you help me with an advise ?
Thank you all !
I try to count cells that are greater than 0 from a row where the columns are moving from hide to unhide. I need to ignore the hidden cells. Every solution that i use was not work. My cells that i need to count are from C25:L25.
I tried :
1. =COUNTIF(C25:L25,">0") -> not working because depends on a cell value i hide some columns.
2. =SUMPRODUCT(SUBTOTAL(103,OFFSET(C25:L25,ROW(C25:L25)-ROW(C25),,1)),--(C25:L25>0)) -> returns me only #value! (i don`t know why)
3. I have also a module -> doesn`t work because it count also if the cell is 0
VBA Code:
Function COUNTVISIBLE(Rg)
Dim xCount As Long
Dim xCell As Range
Application.Volatile
For Each xCell In Rg
If (Not xCell.EntireRow.Hidden) And (Not xCell.EntireColumn.Hidden) Then
xCount = xCount + 1
End If
Next
COUNTVISIBLE = xCount
End Function
Can you help me with an advise ?
Thank you all !