excel vba - Copy and paste array of data to remove blanks rows of data -
i'm trying develop script moves 1 sheet , copies data 1 table another. problem i’m having source table doesn't have rows populated data , destination needs presented data collapsed without blank rows. source data can vary 100 1000 rows each time script used.
i have tried number of solutions, remove blanks, remove duplicates, , these don't work.
here script have been using.
sub as1055datacrunch() sheets("data extract").select range("bi3").select range(selection, selection.end(xltoright)).select range(selection, selection.end(xldown)).select selection.copy sheets("as 1055 table").select range("c8").select activesheet.paste selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=true call removegaps end sub sub removegaps() range(selection, selection.end(xltoright)).select range(selection, selection.end(xldown)).select .value = .value .removeduplicates columns:=1, header:=xlno on error resume next .specialcells(xlcelltypeblanks).delete xlshiftup on error goto 0 end end sub
i'm wondering there way can have data copied array of kind , pasted in consolidated table of data.
this should work, deletes blank rows
sub removegaps() dim ro integer, first integer, last integer first = selection.row last = first + selection.rows.count - 1 ro = last first step -1 ''checking blank columns in column c e if application.worksheetfunction.counta(range("c" & ro & ":" & "e" & ro)) = 0 range(ro & ":" & ro).rows.delete shift:=xlup end if next ro end sub
Comments
Post a Comment