title: Remove Duplicates from a table headers in Excel in vba
body: <p>I'm trying to remove multiple duplicates in Excel 2016 VBA from a imported XML file.</p>
  
  <p>It works with a array:</p>
  
  <pre><code>ActiveSheet.Range("%tableName%").RemoveDuplicates Columns:=Array(8, 10, 12, 26, 40), Header:=xlYes
  </code></pre>
  
  <p>But I the problem is that I don't always know what column my data I want to remove duplicates from is. this week it could be 8, 10, 12, 26, 40 next week it could be 9, 10, 15, 26, 40. </p>
  
  <p>It is always the same table header names: </p>
  
  <pre><code>'8 = Range("%tableName%[udsendelses_dato]")
  '10 = Range("%tableName%[start_tid]")
  '12 = Range("%tableName%[udsendelses_titel]")
  '26 = Range("%tableName%[Titel]")
  '40 = Range("%tableName%[Varighed]")
  </code></pre>