Auto Filter of range class failed

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.

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
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You can do it with a table like
Code:
   ActiveSheet.Range("A2").AutoFilter field:=Columns(vColumn).Column, Criteria1:=vFilter
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top