Find the word "total" in a cell, delete row or column

  • Thread starter Thread starter Lawlerd
  • Start date Start date
L

Lawlerd

Hi, I need help. Is it possible to search for the word "total" in an
cell on the active Excel worksheet, then delete the entire row and/o
column where "total" exists ?
Any help is appreciated. Thanks :
 
Hi Lawlerd, this code was posted by Frank Kabel, it should do what you
you need, it will delete every row with the word 'total' in column A...

Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "A").Value = "total" Then
Rows(RowNdx).Delete
End If
Next RowNdx
End Sub

ste
 

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