To show the sunbtotal in retrieved rows

P

pol

Please help to show the subtotal under the last column + 1 of O . I am using
the following command. But the problem is while filtering the record the
subtotal is not displayed in the last column of the retrieved rows. Please
help

Range("O" & LastRow).Select
ActiveCell.Formula = "=SUBTOTAL(9,O3:O" & LastRow - 1 & ")"

With thanks
Pol
 
M

Mike H

I see my response to your last post worked because your using the code. I
thought it hadn't helped because you never bothered responding.

Perhaps this will solve your currect problem

lastrow = Cells(Rows.Count, "O").End(xlUp).Row
Range("O" & lastrow + 1).Formula = "=SUBTOTAL(9,O3:O" & lastrow & ")"

Please feel free to let me know if it does!!

Mike
 
P

pol

Thanks Mike,

Still that problem exist . When I am filtering the record the subtotal will
disappear. But at the same time I am removing the all filter , the subtotal
wil be shown.

Please help Mike
With thanks
Pol
 
M

Mike H

How are you filtering? on the worksheet or with a macro. In either case if
you include the formula cell in the filtered range you'll hide it

Mike
 
P

pol

I am filtering manually. the subtotal is showing in O194 cell. But When I am
filtering this rows will disappear. That is the problem . End of the rows is
not working properly while filtering

with thanks
Pol
 
M

Mike H

Leave a gap of 1 row then the formula won't be filtered out

lastrow = Cells(Rows.Count, "O").End(xlUp).Row
Range("O" & lastrow + 2).Formula = "=SUBTOTAL(9,O3:O" & lastrow & ")"

Mike
 
P

pol

Thanks a lot Mike..

Now I hope it will work.

But what is the problem on previous rows. I can't locate the exact problem.
So is not possible to show just that bottom of that column ?
 
M

Mike H

When you filter Excel filters the continuous range so you must leave a gap to
exclude the formula from the filter.

Mike
 
P

pol

Thanks Mike, Very much
Is any other mathod to show the subtotal thru macros just below the column
while
filtering

With thanks
Pol
 

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