title: Delete duplicate entries in a column in excel 2003 vba
body: <p>Well the question is, I have got a column, for example column Y has many entries in it, nearly 40,000 and It increases everyweek. The thing is I have to check for duplicates in Y column and delete the entire row. Thus, Y column should have only unique entries.</p>
  
  <p>Suppose I have 3,000 entries and after 1 week, i'll have about 3,500 entries. Now I have to check these newly added 500 columnn values  not the 3,500 with the old + the new i.e 3,500 entries and delete the duplicated row. The old 3,000 shouldn't be deleted or changed. I have found macros but they do the trick for the entire column. I would like to filter the new 500 values.</p>
  
  <pre><code> Cells(2, "Q").Formula = "=COUNTIF(P$1:P1,P2)=0"   'I have used these formula 
   Range("Q2").Copy Destination:=Range("Q3:Q40109")  'it gives false for the duplicate values
  </code></pre>
  
  <p>I know we have to use <code>countif</code> for the duplicate entries. But what Iam doing is applying the formula and then search for false entries and then delete it. I belive applying formula and finding false and then deleting its little bit time consuming.</p>
  
  <pre><code>Sub DeleteDups() 
  Dim x               As Long 
  Dim LastRow         As Long 
  LastRow = Range("A65536").End(xlUp).Row 
  For x = LastRow To 1 Step -1 
      If Application.WorksheetFunction.CountIf(Range("A1:A" &amp; x), Range("A" &amp; x).Text) &gt; 1 Then 
          Range("A" &amp; x).EntireRow.Delete 
      End If 
  Next x   
  End Sub 
  </code></pre>
  
  <p>This is what I found on google but i dont know where the error is. It is deleting all the columns if i set </p>
  
  <pre><code>For x = LastRow To 1 Step -1 
  For x = LastRow to step 3000 ' It is deleting all 500 columns but if it is -1 working fine
  </code></pre>
  
  <p>Any modifications need to be done for these function? or sugest me any good function that helps me. Check for the duplicate values of  a selected column range from the entire column. I mean check 500 entires column values with the 3500 column entry values and delete the duplicates in 500 entries</p>
  
  <p>Thanks in advance</p>