Hello All,
I'm trying to write some VBA code that deletes table rows based on data in two columns. The two columns have Headers "LocationCode" and "ServiceType" in my Table, which is "Table2".
What I'm trying to do is look at all like values in the "LocationCode" column and see if there is a row under the "ServiceType" column that has an "H".
If it DOES NOT have an "H" under ServiceType for that LocationCode I want to delete the row.
For example, in the below table, all of the "Loc00002" rows would get deleted because there is no corresponding "H" in the ServiceType column. The other two locations, no lines would get deleted. Any ideas how to code this? Thank you!!
I'm trying to write some VBA code that deletes table rows based on data in two columns. The two columns have Headers "LocationCode" and "ServiceType" in my Table, which is "Table2".
What I'm trying to do is look at all like values in the "LocationCode" column and see if there is a row under the "ServiceType" column that has an "H".
If it DOES NOT have an "H" under ServiceType for that LocationCode I want to delete the row.
For example, in the below table, all of the "Loc00002" rows would get deleted because there is no corresponding "H" in the ServiceType column. The other two locations, no lines would get deleted. Any ideas how to code this? Thank you!!
LocationCode | ServiceType |
Loc000001 | H |
Loc000001 | Z |
Loc000001 | TST |
Loc00002 | CCS |
Loc00002 | ROC |
Loc0000003 | H |
Loc0000003 | H |