Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- 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