L
Lee Jeffery
Each fortnight I receive a set of data in a spreadsheet which I need t
sort and format. So far I can format the sheet and sort and delete row
with values of <=0 in Column G.
In column A is a set of two letter codes (EA, BC, HP, etc) which ca
vary each month so the macro I recorded to apply autofiltering bomb
out when it finds one of these codes which didn't exist in the sheet
used to record the macro. It's also only deleting 1 row at a time afte
filtering. I'm not sure how to set the variable for the two lette
codes or how to delete all the rows which show after autofilterin
without manually selecting them as the row numbers are different eac
time.
I have reproduced the relevant macro code in part and I woul
appreciate some help in the right direction. Many thanks if you ca
help.
Sub Format570()
Application.ScreenUpdating = False
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="BC"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="EA"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="EE"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="EI"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Application.ScreenUpdating = True
End Su
sort and format. So far I can format the sheet and sort and delete row
with values of <=0 in Column G.
In column A is a set of two letter codes (EA, BC, HP, etc) which ca
vary each month so the macro I recorded to apply autofiltering bomb
out when it finds one of these codes which didn't exist in the sheet
used to record the macro. It's also only deleting 1 row at a time afte
filtering. I'm not sure how to set the variable for the two lette
codes or how to delete all the rows which show after autofilterin
without manually selecting them as the row numbers are different eac
time.
I have reproduced the relevant macro code in part and I woul
appreciate some help in the right direction. Many thanks if you ca
help.
Sub Format570()
Application.ScreenUpdating = False
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="BC"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="EA"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="EE"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="EI"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Application.ScreenUpdating = True
End Su