Hello Everyone,
I know that code looks awful but i am just very new to this.
What i want to do is make this code run for the all sheets that is open and save the file.
And is it possible to make it run an other code in the same macro with the same layout only the filter array is different.
I know that code looks awful but i am just very new to this.
What i want to do is make this code run for the all sheets that is open and save the file.
Code:
ChDir "C:\Documents and Settings\aozben\Desktop\Cap Rep LongRange\1\"
Workbooks.Open Filename:= _
"C:\Documents and Settings\aozben\Desktop\Cap Rep LongRange\1\TK_LO_CAP_REP.xls"
With ActiveSheet
.Range(Selection, ActiveCell.SpecialCells(xlLastCell)).AutoFilter Field:=1, Criteria1:=Array( _
"AYT", "DGT", "DHA", "DHQ", "DLB", "DLD", "DLI", "ETF", "FAA", "GBB", "IMT", "TIE", "TIP", _
"YSE", "YSM", "YSP", "MAA", "YSA"), Operator:=xlFilterValues
.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.Range("$A$3:$AG$10000").AutoFilter Field:=1
End With
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\aozben\Desktop\Cap Rep LongRange\1\" & "AAP_TK_LO_CAP_REP.xls (" & Format(Date, "dd-mm-yyyy") & ").xls" _
, FileFormat:=xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
And is it possible to make it run an other code in the same macro with the same layout only the filter array is different.
Code:
ChDir "C:\Documents and Settings\aozben\Desktop\Cap Rep LongRange\1\"
Workbooks.Open Filename:= _
"C:\Documents and Settings\aozben\Desktop\Cap Rep LongRange\1\TK_LO_CAP_REP.xls"
With ActiveSheet
.Range(Selection, ActiveCell.SpecialCells(xlLastCell)).AutoFilter Field:=1, Criteria1:=Array( _
"AAP", "DGT", "DHA", "DHQ", "DLB", "DLD", "DLI", "ETF", "FAA", "GBB", "IMT", "TIE", "TIP", _
"YSE", "YSM", "YSP", "MAA", "YSA"), Operator:=xlFilterValues
.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.Range("$A$3:$AG$10000").AutoFilter Field:=1
End With
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\aozben\Desktop\Cap Rep LongRange\1\" & "AYT_TK_LO_CAP_REP.xls (" & Format(Date, "dd-mm-yyyy") & ").xls" _
, FileFormat:=xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False