beginvbaanalyst
Board Regular
- Joined
- Jan 28, 2020
- Messages
- 141
- Office Version
- 365
- Platform
- Windows
Hi Everyone,
I created a macro using the Macro Recorder but wanted to see if there's a much easier way to filter and paste a new sheet with less code.
I want it to filter for anything within the column and not a selected range ("$I$1:$M$83").
Would I use something like to select anything within the column:
Range("I2", Range ("I" & Rows.Count).End(xlUp)
Essiently I want to end up look up anything that has a 0 within my J Column.
My Macro Recorder Code is:
Sub TestFilter()
'
' TestFilter Macro
' EinaFilter
'
'
Range("I1:M1").Select
Selection.AutoFilter
ActiveSheet.Range("$I$1:$M$83").AutoFilter Field:=2, Criteria1:="1"
ActiveSheet.Range("$I$1:$M$83").AutoFilter Field:=3, Criteria1:="0"
Sheets("Sheet1").Select
Sheets("Sheet1").Copy After:=Sheets(1)
End Sub
I created a macro using the Macro Recorder but wanted to see if there's a much easier way to filter and paste a new sheet with less code.
I want it to filter for anything within the column and not a selected range ("$I$1:$M$83").
Would I use something like to select anything within the column:
Range("I2", Range ("I" & Rows.Count).End(xlUp)
Essiently I want to end up look up anything that has a 0 within my J Column.
My Macro Recorder Code is:
Sub TestFilter()
'
' TestFilter Macro
' EinaFilter
'
'
Range("I1:M1").Select
Selection.AutoFilter
ActiveSheet.Range("$I$1:$M$83").AutoFilter Field:=2, Criteria1:="1"
ActiveSheet.Range("$I$1:$M$83").AutoFilter Field:=3, Criteria1:="0"
Sheets("Sheet1").Select
Sheets("Sheet1").Copy After:=Sheets(1)
End Sub