VBA - Autofilter and copy visiable data to another feild -


i have dataset want vba auto-filter , in column b unselect 0 , keep other values.

then copy visible cells new sheet. can me error is

thanks

sub findlastrowwithvaluefilter() activeworkbook.sheets("cascade -offshore upload format").activate  lastrow = activesheet.cells.specialcells(xlcelltypelastcell).row      range("a1:q" & lastrow)         .autofilter         .autofilter field:=2, criteria1:="select all", operator:=xland, criteria1:="<>0"          end      range("a2:q" & lastrow).select     activesheet.range("a1:q1" & lastrow).offset(1, 0).specialcells(xlcelltypevisible).copy     sheets("sheet1").select     range("a1").select     selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _         :=false, transpose:=false  msgbox (lastrow)  end sub 

replace

.autofilter field:=2, criteria1:="select all", operator:=xland, criteria1:="<>0" 

with

.autofilter field:=2, criteria1:="<>0", operator:=xland 

and should work


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -