last day (15 days later) » 

4:55 PM
0
Q: excel vba - delete all rows except header and subtotal

m0atzI'm using the following code whereby I have set a range in a filtered list and I want to delete the visible cells. I have offset by 1 because of the header row, but I also have a row at the very bottom of the code with my totals in the last row, how can I delete all visible rows except the very l...

 
Include the "Totals" row also in rng. The total row will not show when you use autofilter as it doesn't meet the autofilter criteria. That ways you will not have to worry about not deleting it. Or have I misunderstood your question...
 
user2672288
The total row always shows as I'm filtering out rows that don't contain certain things. I Suppose I could redo the total row after the deleting has finished but would be nice to get it in the above code somehow
 
user2672288
I should add that the total row actually totals other columns and not the one I'm filtering
 
Two questions. 1) Will the last row always have numbers in Col 5, Row 10. 2 Will the column 5 have numbers anywhere else
 
user2672288
The last row Col 5 is always blank. All cells in my data in Col 5 are strings
 
4:55 PM
I think I may have a very easy solution for you :) Will the totals always be in row 5?
 
user2672288
They start in row 250 but then I filter so could be anywhere...
 
user2672288
hey
 
Hi
Do the totals can be in any row?
 
user2672288
yeah, so before i autofilter they're in row 250, then when i autofilter they could be anywhere as the data i'm filtering out will change
 
user2672288
so i guess if i autofilter then get the last row, hide the last row as you suggested, then do the delete, would that work you think?
 
4:59 PM
No the row number will always be the same :) so simply change the 10 in my code to 250
 
user2672288
ah - awesome!!!
 
user2672288
you're right - it works!! wow, how stupid was i
 
thats ok :) cya.
 
user2672288
cya
 
hi guys
can someone help me out with an array problem
in vba
oops wrong room sorry
 

last day (15 days later) »