Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help (Uppercase multiple ranges?) | Excel Discussion (Misc queries) | |||
How do I delete a macro in Excel 2003? Button is greyed out. | Excel Discussion (Misc queries) | |||
Delete specific text in spreadsheet | Excel Worksheet Functions | |||
macro to insert row after specific text | Excel Discussion (Misc queries) | |||
Macro data selection line delete | Excel Discussion (Misc queries) |