excel vba - delete all rows except header and subtotal -


i'm using following code whereby have set range in filtered list , want delete visible cells. have offset 1 because of header row, have row @ bottom of code totals in last row, how can delete visible rows except last keep totals?

with rng     .autofilter field:=5, criteria1:="<>*" & owner & "*"     .offset(1, 0).specialcells(xlcelltypevisible).entirerow.delete end 

thanks

try this

.autofilter field:=5, criteria1:="<>*" & owner & "*" activesheet.rows(250).hidden = true .offset(1, 0).specialcells(xlcelltypevisible).entirerow.delete 

edit: post discussion in chat.

the row address never changes when autofilter. hide row after autofilter , done :)


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -