Click here to Skip to main content
15,917,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am try to develop excel application for different log entries for frequency data which contain duplicate values in it.I am trying to find the way to search that frequency entry in entire column range of same row(2nd) and if duplicate entries found then remove that record else overwrite new entries of particular record.

I have give example below:

Amplitude|Phase| Status|   Amplitude|Phase  |Status
4 MHz|	4 MHz|	  4 MHz|    4 MHz   |4 MHz  |4 MHz|
-21.9603|-133.59|connected |-21.9603|-133.59|connected			
-21.7973|-132.802|connected|-21.7973|-132.802|connected	


e.g.If I found 4MHz frequency value in 2nd row with similar value in next columns by skipping 2 columns(because it contains same entry record) then that column should be deleted.
I was trying multiple options but it's not working.Below i paste code for delete duplicate columns,please suggest any correction in that code.
VB
Sheets(2).Range("D3:F" & lastRow).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
Posted
Updated 30-Sep-15 5:36am
v3

1 solution

You can't delete duplicate columns via using RemoveDuplicates method! You can delete duplicate rows.

Please, see: Range.RemoveDuplicates Method (Excel)[^]

So, to be able to get only unique rows, copy data from D3:Fxx range and paste it below data placed in A1:Cxx. Then you'll be able to run this code:
VB
Sheets(2).Range("A3:C" & lastRow).RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900