Hello all, 1st time poster so please be patient with me.
I was wondering if anyone could help me solve an issue I'm having with creating a macro to filter some data from one sheet to another. I used the "record a macro" function to get the code I've posted below but when I run the macro, it only gives me headings of the columns in the "Inputs" sheet .
In my workbook I have a main sheet called "Inputs" and another sheet called "Sheet1". The code below works when I manually apply an advanced filter (Data>> Advanced>>Ok) but does not do what I need it to do when I run the macro.
I have created Named Ranges entitled "Data", "Criteria" and "Extract"
Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+d
'
Range("Data").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"Criteria"), CopyToRange:=Range("Extract"), Unique:=False
End Sub
I checked this against a 2nd macro in which I didn't use the named ranges. Again the same result: When I apply the advanced filter manually, it works. When I run the filter from the macro, it gives me the headings of the columns in the "Inputs" tab.
Sub Macro3()
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+Shift+S
'
Sheets("Inputs").Columns("A:V").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("A7:B8"), CopyToRange:=Sheets("Sheet1").Range("A10:V10"), Unique:= _
False
End Sub
I would like an amendment to the above macos that will allow the correct data to be displayed for the relevant criteria. I know I've probably left something basic out, but I just can't figure out what despite trawling through forums and comparing other peoples codes to mine. Any help would be greatly appreciated.
My thanks in advance
Nick
Bookmarks