jevi
Active Member
- Joined
- Apr 13, 2010
- Messages
- 339
- Office Version
- 2016
- Platform
- Windows
Hi All,
I have registered this macro but is not taking correctly the autofilter rule (criteria). I need to filter the data based on column X1 (data are from A1:A200 but may vary everyday the row of data) and have only the values that are <> "OK". I try to write it in the macro but is not working.
Please any help?
Thank you,
Range("X1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$X$200").AutoFilter Field:=24, Criteria:="<>OK", _
I have registered this macro but is not taking correctly the autofilter rule (criteria). I need to filter the data based on column X1 (data are from A1:A200 but may vary everyday the row of data) and have only the values that are <> "OK". I try to write it in the macro but is not working.
Please any help?
Thank you,
Range("X1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$X$200").AutoFilter Field:=24, Criteria:="<>OK", _
VBA Code:
Macro1 Macro
'
'
Windows("CDatabase.xlsx").Activate
Columns("A:W").Select
Selection.Copy
Windows("C Report.xlsm").Activate
Columns("A:W").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("X1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$X$200").AutoFilter Field:=24, Criteria:="<>OK", _
Sheets("DATABASE").Select
Columns("A:X").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Sheets.Add After:=ActiveSheet
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B7").Select
Sheets("P").Select
Windows("C Database.xlsx").Activate
ActiveWorkbook.Save
ActiveWindow.Close
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub