samedi 18 avril 2015

Remove XML duplicate items in excel using VBA

I have 10 excel sheets each I've loaded with different XML feed connections. So, In order to get followed those 10 list updates regularly I used XML append data!


But the problem here is, that feed is giving duplicate items each time I XML table refresh.


Now, I want a VBA code remove all those duplicate items in all sheets at once.


Here is the code I am using:



Sub Macro_Table()
Dim ws As Worksheet
Dim xmltable As LisObject

For Each ws In ThisWorkbook.worksheets
Set xmltable = ws.ListObjects(1)
xmltable.Range().RemoveDuplicate Columns:=Array(4), Headers:= Yes
Next ws
End Sub


But when running this - the following error is coming



"Sub script out of range"


I don't know where is the problem but I am new to VBA. Please help me.


Aucun commentaire:

Enregistrer un commentaire