Tags: delete, Excel, duplicate, rows, filter, advanced filter
Verified on the following platforms
Visual Basic
'Delete duplicate rows in excel using advanced filter 'Francis de la Cerna ' 'I've been doing this the long way for, well, a long time. 'Sorry, excel, I didn't know you could do that. set xl = createobject("excel.application") set wb = xl.workbooks.add set ws1 = wb.worksheets("sheet1") set ws2 = wb.worksheets("sheet2") xl.visible = true 'add some data to sheet1 ws1.range("a1:c1").value = array("a", "b", "c") ws1.range("a2:c2").value = array( 1 , 2 , 3 ) ws1.range("a3:c3").value = array( 4 , 5 , 6 ) ws1.range("a4:c4").value = array( 7 , 8 , 9 ) ws1.range("a5:c5").value = array( 4 , 5 , 6 ) ws1.range("a6:c6").value = array( 1 , 2 , 3 ) ws1.range("a7:c7").value = array("a", "b", "c") 'filter unique records and copy result in sheet2 starting in cell a1 'i think the 1st row is considered as a header row xlFilterInPlace = 1 xlFilterCopy = 2 uniqueRecords = true ws1.range("a1:c7").advancedFilter xlFilterCopy, , ws2.range("a1"), uniqueRecords
Windows Server 2008 R2 | No |
Windows Server 2008 | No |
Windows Server 2003 | No |
Windows 7 | No |
Windows Vista | No |
Windows XP | Yes |
Windows 2000 | No |
This script is tested on these platforms by the author. It is likely to work on other platforms as well. If you try it and find that it works on another platform, please add a note to the script discussion to let others know.
0 Comment to "Delete duplicate rows in excel using advanced filter"
Post a Comment