Excel 2003 macro: Remove Duplicates

Compare cells and delete row if it already exists

Page 1 of 1

0 Replies - 2713 Views - Last Post: 24 June 2009 - 02:00 PM Rate Topic: -----

#1 meatloaf   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 65
  • Joined: 05-September 07

Excel 2003 macro: Remove Duplicates

Post icon  Posted 24 June 2009 - 02:00 PM

Want: Compare cells in column A:B and delete the row if the cell has already occured
I made a macro in Excel 2007, but when I attempted to use the code in Excel 2003, this string of code would not work:
	ActiveSheet.Columns("A:B").RemoveDuplicates Columns:=1, Header:=xlNo



So I tried recording a macro in Excel 2003, resulting in:
	Columns("A:B").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
	Selection.Copy
	Application.CutCopyMode = False
	ActiveSheet.ShowAllData
	Selection.ClearContents
	Columns("A:B").Select
	ActiveSheet.Paste



But when attempting to run, it errors on the ActiveSheet.Paste line:
something like cannot use this code in Workbork?...if needed, I can get the error to quote.

What is the best way about this? I don't understand why ActiveSheet.Paste is wrong!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1