excel - Copy data from a dynamic range -


i'm trying copy data column in dynamic (ever changing) spreadsheet, spreadsheet. original has data don't need so, need removed. copy , paste part easy, but, when record , run it, error.

sub bos()  sheets("box").select range("n17").select range(selection, selection.end(xldown)).select range(selection, selection.end(xldown)).select range(selection, selection.end(xldown)).select selection.copy sheets("sheet2").select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false selection.specialcells(xlcelltypeblanks).select application.cutcopymode = false selection.entirerow.delete activesheet.range("$a$3:$s$61").autofilter field:=1, criteria1:=array("na", "these listed in fdo report- see notes.", "will included in fdo report"), operator:=xlfiltervalues rows("6:52").select selection.delete shift:=xlup activesheet.range("$a$3:$s$56").autofilter field:=1 range("l25").select end sub 

error screenshot: enter image description here

seems me it's erroring because it's not finding blank cells. easiest solution without changing code around replace these lines:

selection.specialcells(xlcelltypeblanks).select application.cutcopymode = false selection.entirerow.delete 

with this:

application.cutcopymode = false  if application.worksheetfunction.countblank(selection) > 0     selection.specialcells(xlcelltypeblanks).select     selection.entirerow.delete end if 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -