Filter Macro Error

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi please hope you can help, I have the code below where I have a command button which I have renamed to FilterData, then I have created a macro and assigned it to the FilterData button, but it doesn't work, the 2 lines below gets highlighted in yellow, I have also attached the whole code at bottom, I have a work issue sheet with all the data then I want this filtered into the sheet called filter but its not working, I hope you can help, I also have a combobox1 where the name gets copied into cell C% in filter, then this is copied into work issued cell M2 with a formula =Filter!C5, I hope I have explained this ok and hope you can help.
Code:
    Sheets("Work Issue").Range("Table1[#All]").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
        Sheets("Work Issue").Range("M1:N2"), CopyToRange:=Sheets("Filter").Range("B10"), Unique:=True


Code:
Sub FilterData()
    Sheets("Filter").Select
    Range("B10").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Clear
    
    Sheets("Work Issue").Range("Table1[#All]").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
        Sheets("Work Issue").Range("M1:N2"), CopyToRange:=Sheets("Filter").Range("B10"), Unique:=True
    Columns.AutoFit
    Range("B10").Select
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Travelling so cannot test anything
Your code worked for me (post#2)

and when I explained what might be wrong you said in post#3
I understand why I am getting the error then
So why the same question? :confused:

What is the actual table name?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

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