Delete rows with specific leftmost value

  • Thread starter Thread starter CLR
  • Start date Start date
C

CLR

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
 
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
 
Outstanding Mike...........your code works like a charm.........

Thank you very much!

Vaya con Dios,
Chuck, CABGx3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top