![]() |
Delete rows with specific leftmost value
Hi All..........
I have a file that I am importing by macro and it comes in all in column A........I know how to separate the columns with a SPACE delimiter, but before doing that, I would like to delete all rows that begin with a specific order of characters, (space space SUPPL), by having a macro read column A and do the deletions.........if someone would be so kind............. TIA Vaya con Dios, Chuck, CABGx3 |
Delete rows with specific leftmost value
Put this in a general code module.
Sub DeleteRow() Dim R As Long Dim C As Range Dim Rng As Range Set Rng = ActiveSheet.UsedRange.Rows For R = Rng.Rows.Count To 1 Step -1 Set C = Range("A" & R) If Left(C, 7) = " SUPPL" Then Rng.Rows(R).EntireRow.Delete End If Next R End Sub Mike F "CLR" wrote in message ... Hi All.......... I have a file that I am importing by macro and it comes in all in column A........I know how to separate the columns with a SPACE delimiter, but before doing that, I would like to delete all rows that begin with a specific order of characters, (space space SUPPL), by having a macro read column A and do the deletions.........if someone would be so kind............. TIA Vaya con Dios, Chuck, CABGx3 |
Delete rows with specific leftmost value
Outstanding Mike...........your code works like a charm.........
Thank you very much! Vaya con Dios, Chuck, CABGx3 "Mike Fogleman" wrote in message ... Put this in a general code module. Sub DeleteRow() Dim R As Long Dim C As Range Dim Rng As Range Set Rng = ActiveSheet.UsedRange.Rows For R = Rng.Rows.Count To 1 Step -1 Set C = Range("A" & R) If Left(C, 7) = " SUPPL" Then Rng.Rows(R).EntireRow.Delete End If Next R End Sub Mike F "CLR" wrote in message ... Hi All.......... I have a file that I am importing by macro and it comes in all in column A........I know how to separate the columns with a SPACE delimiter, but before doing that, I would like to delete all rows that begin with a specific order of characters, (space space SUPPL), by having a macro read column A and do the deletions.........if someone would be so kind............. TIA Vaya con Dios, Chuck, CABGx3 |
All times are GMT +1. The time now is 12:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com