This will loop through all the worksheets if that's what you want.
AdvancedFilter assumes the top cell (B1 in the case) in the filter range to be a header.
Sub PopulatePlayers()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name <> "Overall Leaderboard" Then
If Not IsEmpty(ws.Range("B1")) Then
With ws.Range("B1", ws.Range("B" & Rows.Count).End(xlUp))
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Offset(1).Copy Sheets("Overall Leaderboard").Range("B" & Rows.Count).End(xlUp).Offset(1)
If ws.FilterMode Then ws.ShowAllData
End With
End If
End If
Next ws
End Sub
This copies from just the activehseet.
Sub PopulatePlayers()
With Range("B1", Range("B" & Rows.Count).End(xlUp))
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Offset(1).Copy Sheets("Overall Leaderboard").Range("B" & Rows.Count).End(xlUp).Offset(1)
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
End With
MsgBox "Unique Players copied", vbInformation, "Copy Complete"
End Sub
Bookmarks