![]() |
Macro - delete entire row which contain a specific text
To the masters of the excel:
I have the following macro. How can I change the range to look up form (a:a) to multiple ranges. say like Column A, B, C, X, Y and Z? Sub DeleteRows() Dim myWord As String Dim FoundCell As Range Dim wks As Worksheet Set wks = Worksheets("sheet1") myWord = "Test" With wks.Range("a:a") Do Set FoundCell = .Cells.Find(what:=myWord, _ after:=.Cells(.Cells.Count), _ lookat:=xlWhole, MatchCase:=False) If FoundCell Is Nothing Then Exit Do Else FoundCell.EntireRow.Delete End If Loop End With Can anyone help me? Thanks -Dileep Chandran End Sub |
Macro - delete entire row which contain a specific text
Sorry a small change:
It should delete the rows, only when all the columns (Column A, B, C, X, Y and Z) contains the specified text and not if any one of the columns contains the specified text ("Test"). -Dileep |
All times are GMT +1. The time now is 04:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com