There's a column with email addresses. Some are unique, some a repeated. This bit of code will get the unique ones out and paste that list into a specified range.
Sub Filter_Uniques()
Dim uniquesArray()
Dim lastRow As Long
With Sheet1
Sheets("WORKING").Columns("D:D").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range("E1"), Unique:=True
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
uniquesArray = .Range("E1:E" & lastRow)
End With
End Sub
This is two lines of a recorded macro that filters a column:
Sub Macro1()
ActiveSheet.Range("$A$1:$D$22").AutoFilter Field:=4, Criteria1:= _
"a@bot.com"
End Sub
What I want is to be able to loop over the unique list and enter those one by one into the criteria (and then do some other code before the next loop iteration).
EDIT: It isn't a duplicate of "Excel macro to copy data from one sheet to another based on specific matching conditions" because I'm not asking how to copy data from one sheet to another.
It isn't a duplicate of "Create a new sheet for each unique agent and move all data to each sheet" because I'm not trying to move data to different sheets.
Nowhere in this question have I asked to move/copy data. Please read the question, and if you don't understand the question, ask for clarification if you're interested in answering.