excel vba - Extracting Unique Items & Creating new column in new sheet -


i have column in "sheet1" d11:d5000 number of codes/id's (these include letters,numbers,hiphens) , want extract unique items , enter them in "sheet2" down cell b6.

my attempt has been write advanced filter vba. have several columns need work done , want create button or user form use code on multiple ranges.

enter image description here

step 1 copy paste unique

looking @ stackoverflow found excellent answer can used select range , copy unique elements range another.

step 2 userinteraction

next, need user interaction. user needs specify range pick unique elements , range or cell unique elements pasted.

i googled "get range user vba". ended here.

in code below put both things

sub userinteraction() dim from_range range dim to_range range set from_range = application.inputbox("select range ids", "obtain range object", type:=8) set to_range = application.inputbox("select single cell start pasting", "obtain range object", type:=8) from_range.advancedfilter action:=xlfiltercopy, copytorange:=to_range, unique:=true end sub 

the code works if user selects single cell second range. if think necessary might want add error checking that. also, might want have nicer ui. see code starting point develop further.


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 -