Forum Discussion

jee007's avatar
jee007
Copper Contributor
Jul 12, 2021
Solved

VBA code for removing duplicates

Hi, I am trying to create a VBA code that would copy a column from another sheet and then remove any duplicate. The number of rows might vary.   Device: Microsoft Surface Pro (5th Gen) (Intel Core...
  • Riny_van_Eekelen's avatar
    Jul 13, 2021

    jee007 Why bother learning VBA if you can do it with a few clicks and/or with standard Excel options.

     

    Format the data range in "the other sheet" as a structured Excel table (Ctrl-T). Select a cell anywhere inside the table and you'll notice a Design ribbon at the top. Open it and look for the icon "Remove duplicates" and follow the instructions. 

     

    Alternatively, you could look into the UNIQUE function. It displays only the unique values from a range in what is called a dynamic array. Thus, effectively removing duplicates.

Resources