Hi, everyone,
I am trying to delete many rows in a spreadsheet with over 45000 records. There are 10 columns and column B is the determinant of whether a row should be deleted. The criteria is that if column B contains format like 'P00000xxxx, then it should be retained. Otherwise, the whole row will be deleted. I started to record some codes but then was stuck with the deletion portion. Can anyone help?
Below are the codes that I tried to use:
Dim rng As Range, PCrng As Range, PCstring As String
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Set rng = Range(Selection, Selection.End(xlDown)).Select
For Each PCrng In rng
If PCrng.Value <> " 'P00000xxxx ' I don't know how to search this format, the last 4 digits will vary from case to case.
then delete the row
I am trying to delete many rows in a spreadsheet with over 45000 records. There are 10 columns and column B is the determinant of whether a row should be deleted. The criteria is that if column B contains format like 'P00000xxxx, then it should be retained. Otherwise, the whole row will be deleted. I started to record some codes but then was stuck with the deletion portion. Can anyone help?
Below are the codes that I tried to use:
Dim rng As Range, PCrng As Range, PCstring As String
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Set rng = Range(Selection, Selection.End(xlDown)).Select
For Each PCrng In rng
If PCrng.Value <> " 'P00000xxxx ' I don't know how to search this format, the last 4 digits will vary from case to case.
then delete the row