VBA Excel Unfiltering but not unhiding rows -


i writing code filter data , copy it. after which, want unfilter original state. using activesheet.showalldata statement unhides hidden rows well. there set of code allows me unfilter filtered data not unhide rows hidden?

thanks answering

edit: code if helps.

sub copytoamortizing()

dim tbl range dim visiblecells integer dim lr long  sheets("template").select columns("a:az").entirecolumn.hidden = false if not activesheet.autofilter nothing cells.autofilter range("a5:ab5").select range(selection, selection.end(xldown)).select set tbl = selection  activesheet.range("$a$3:$n$9999").autofilter field:=1, criteria1:= _     "amortizing item" 

on error goto point2

visiblecells = tbl.specialcells(xlcelltypevisible).rows.count if visiblecells >= 1  range("a3").select selection.end(xldown).activate lr = activecell.row  range("b3", cells(lr, 12)).select selection.copy sheets("amortizingitems").select range("a2").select selection.pastespecial paste:=xlpastevaluesandnumberformats, operation:= _     xlnone, skipblanks:=false, transpose:=false application.cutcopymode = false rows(2).entirerow.delete range("a2").select sheets("template").select end if 

point2:

activesheet.showalldata columns("a:az").entirecolumn.hidden = false activesheet.outline.showlevels rowlevels:=0, columnlevels:=1 range("a5").select 

end sub

i use filter: activesheet.range("$a$3:$n$9999").autofilter field:=1, criteria1:= _ "amortizing item" , then: activesheet.showalldata

the easy answer turn off autofilter using

sheets("yoursheetname").autofiltermode = false 

here sample add hidden rows array, re-hide after done them...

sub samplehiddenrows()  set hidrows = new collection  set rng = range(cells(5, 4), cells(13, 5))  each cll in rng     if cll.entirerow.hidden = true         hidrows.add cll.row     end if next cll  rng.autofilter field:=1, criteria1:="one" rng.specialcells(xlcelltypevisible).copy   activesheet.autofiltermode = false  t = 1 hidrows.count     rows(hidrows(t)).hidden = true next t  end sub 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -