excel - vba: work with tables and remove duplicates with conditions -


i want use vba copy multiple columns table (removing duplicates , applying constraints) sheet. if possible, in tables formats.

i new vba , don't know if possible need take unique product-store combinations below sales >0

product  store  day     sales apple        monday     3 apple        tuesday    0 apple        wednesday  4 apple      b   thursday   7 pear         monday     3 pear       c   tuesday    0 

therefore, result should be:

product store   apple         apple      b    pear          

i have tried record macro result long...

by way, data quite large think going line line not option.

try this

sub filterandcopy()   columns("a:d").select 'change actual cells holds data  selection.autofilter  columns("a:b").select 'change columns holds products , store data  activesheet.range("$a:$b").removeduplicates columns:=array(1, 2), header :=xlno 'change columns holds products , store data  range("a1", cells(cells(2, 1).end(xldown).row, 2)).select 'change columns holds products , store data  selection.copy  sheets.add after:=activesheet  activesheet.paste  end sub 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -