Good morning all. Hope you are all well.
I have 6 Rows with the titles A1:F1
The lenth of the list will constantly change.
What i would like to do is filter column C.
Copy all the matching results to a new sheet with the sheets name renamed to the search criteria.
I would then like it to go back and search the next filter and repeat the process untill all listed results are split onto their own sheet.
There is no set list for column C it will constantly change. I would like it to just do the action for every unique entry
I had a go with the code taken from the forum but couldnt get it to work
Thankyou for any help
I have 6 Rows with the titles A1:F1
The lenth of the list will constantly change.
What i would like to do is filter column C.
Copy all the matching results to a new sheet with the sheets name renamed to the search criteria.
I would then like it to go back and search the next filter and repeat the process untill all listed results are split onto their own sheet.
There is no set list for column C it will constantly change. I would like it to just do the action for every unique entry
I had a go with the code taken from the forum but couldnt get it to work
Code:
Sub Foo()
Dim c As Range
Dim rng As Range
Dim LR As Long
LR = Cells(Rows.Count, "C").End(xlUp).Row
Set rng = Range("A1:A" & LR)
Range("C1:C" & LR).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AM1"), Unique:=True
For Each c In Range([AM2], Cells(Rows.Count, "AM").End(xlUp))
With rng
.AutoFilter
.AutoFilter Field:=3, Criteria1:=c.Value
.SpecialCells(xlCellTypeVisible).Copy
Sheets.Add(After:=Sheets(Sheets.Count)).Name = c.Value
ActiveSheet.Paste
End With
Next c
End Sub
Thankyou for any help