How to Evaluate Values in the filter used range

  • Thread starter Thread starter venu_muddasani
  • Start date Start date
V

venu_muddasani

I am not getting correct calculation when calculating in filter used
range Please help.
I want to calculate visible rows only after filtering the work sheet.
Totally I filter 5 items each time I filter one item this in a loop.

Example of my code

But All range and allrange1 totals are different

Set AllRange = Worksheets("Quantum Items").UsedRange

allrange1 = AllRange.Columns(1).SpecialCells(xlVisible).Count ' this
is counting visible rows

For j = 2 To allrange1 'AllRange.Rows.Count ' there is a header row
in the range !!

If Rows(AllRange.Cells(j, q_SERVICE).Row).Hidden = False Then
calculate calling a procedure
end if
------------------------
I used another method but it is also not calculating properly means it
not skipping the hidden rows while calculating the code is like this.

Quantum Items work sheet is used with the advanced filter.

Set AllRange = Worksheets("Quantum Items").UsedRange

For j = 2 To AllRange.Rows.Count

If Rows(AllRange.Cells(j, q_SERVICE).Row).Hidden = False Then
calculation
end if


Thanks in advance.
 
in my senario a1 to a10 is all=1
row 5,6,7 is hidden
sub return 7

Sub tst()
For t = 1 To 10
If Rows(t).Hidden = False Then x = x + Cells(t, 1)
Next
MsgBox x
End Sub


"(e-mail address removed)" skrev:
 
Back
Top