How to Evaluate Values in the filter used range

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.
 
E

excelent

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top