I've tried searching the site, but apparently I do not know the proper terminology to get an answer to my problem.
I have a data dump spread sheet with row A1 being the header and actual data starting in cell "A2". Column "A" contains my abbreviated department names. I'd like to write a macro that would prompt me for the department I would like to keep and delete all other rows beginning in row "A2" that do not contain my criteria.
Below is my recorded macro that deletes only "BMT" department. I have 10 other departments and only need to report on one department at any time. The way our programmers set up the data dump is all records from our SQL server, they claim not to have time to make this small change and I should do it via autofilter in excel. I would like to add this routine to my formatting macro.
Sub TEST()
'
Range("A1:O1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>BMT", Operator:=xlAnd
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete
Selection.AutoFilter
Range("A1").Select
End Sub
Any help will be much appreciated.
I have a data dump spread sheet with row A1 being the header and actual data starting in cell "A2". Column "A" contains my abbreviated department names. I'd like to write a macro that would prompt me for the department I would like to keep and delete all other rows beginning in row "A2" that do not contain my criteria.
Below is my recorded macro that deletes only "BMT" department. I have 10 other departments and only need to report on one department at any time. The way our programmers set up the data dump is all records from our SQL server, they claim not to have time to make this small change and I should do it via autofilter in excel. I would like to add this routine to my formatting macro.
Sub TEST()
'
Range("A1:O1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>BMT", Operator:=xlAnd
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete
Selection.AutoFilter
Range("A1").Select
End Sub
Any help will be much appreciated.