title: VBA - Remove Duplicates Across Multiple Sheets in Workbook
body: <p>I have multiple sheets in a particular workbook, and n each sheet there are Employee Numbers. The sheets have already been sorted in a way that Column A is always the Employee Number. </p>
  
  <p>So what I need to do is loop through all the sheets and apply the RemoveDuplicates function to delete all duplicate Employee Numbers found in Column A.</p>
  
  <p>Note - I am not trying to have the Employee Number appear on only one sheet; I am trying to have the Employee Number appear only once on each sheet.</p>
  
  <p>I have it working for when I name a specific sheet, but cannot get it to work in a loop.</p>
  
  <p><em>Test1:</em></p>
  
  <pre><code>Sub deleteDuplicate()
  
      Dim ws As Worksheet
      Dim wkbk1 As Workbook
      Dim w As Long
      Dim lRow As Long
      Dim iCntr As Long
  
      Set wkbk1 = Workbooks("3rd Party.xlsm")
  
      wkbk1.Activate
  
      For Each ws In ThisWorkbook.Worksheets
  
          ' Find last row in column A
          lRow = ws.Range("A" &amp; ws.Rows.count).End(xlUp).Row
  
          For iCntr = lRow To 1 Step -1
  
              ws.lRow.RemoveDuplicates Columns:=1, Header:=xlYes
  
          Next iCntr
  
      Next ws
  
  End Sub
  </code></pre>
  
  <p><em>Test2:</em></p>
  
  <pre><code>Sub deleteDuplicate()
  
      Dim ws As Worksheet
      Dim wkbk1 As Workbook
      Dim w As Long
      Dim lRow As Long
      Dim iCntr As Long
  
      Set wkbk1 = Workbooks("3rd Party.xlsm")
  
      wkbk1.Activate
  
      With wkbk1
  
          For w = 1 To .Worksheets.count
  
              With Worksheets(w)
  
                  .UsedRange.RemoveDuplicates Columns:=1, Header:=xlYes
  
              End With
  
          Next w
  
      End With
  
  End Sub
  </code></pre>