ben_sorensen
New Member
- Joined
- Jun 11, 2015
- Messages
- 44
Hello I keep getting an error that I can't figure out why, I have been racking my brain for hours. I keep getting the auto filter of range class failed and all spelling is correct and there shouldn't be any problems. Here is my code.
Any help would be most apprciated
Best
PHP:
Sub SplitCodeFilterSheet()
Dim wswb As StringDim wssh As String
wswb = ActiveWorkbook.Namewssh = ActiveSheet.Name
vcolumn = InputBox("Which column would you like to match items", "Match this")
Columns(vcolumn).CopySheets.AddActiveSheet.Name = ("_Summary")range("A1").PasteSpecialColumns("A").RemoveDuplicates Columns:=1, Header:=xlYes
vcounter = range("A" & Rows.Count).End(xlUp).Row
For i = 3 To vcounter
vfilter = Sheets("_Summary").Cells(i, 1) ActiveWorkbook.Sheets(wssh).Activate ActiveSheet.Cells(i, vcolumn).Select ActiveSheet.AutoFilterMode = False ActiveSheet.Columns.AutoFilter field:=Columns(vcolumn).Column, Criteria1:=vfilter Cells.Copy Workbooks.Add range("A2").PasteSpecial If vfilter <> "" Then ActiveWorkbook.SaveAs ThisWorkbook.Path & "\Reports\" & vfilter Else ActiveWorkbook.SaveAs ThisWorkbook.Path & "\Reports\_Blank" End If ActiveWorkbook.Close Workbooks(wswb).Activate Next i
Sheets("_Summary").Delete
End Sub
Any help would be most apprciated
Best