ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find the word "total" in a cell, delete row or column (https://www.excelbanter.com/excel-programming/314041-find-word-total-cell-delete-row-column.html)

Lawlerd

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

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 :

--
Lawler
-----------------------------------------------------------------------
Lawlerd's Profile: http://www.excelforum.com/member.php...fo&userid=1547
View this thread: http://www.excelforum.com/showthread.php?threadid=27057


ste mac[_2_]

Find the word "total" in a cell, delete row or column
 
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


All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com