Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 101
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help (Uppercase multiple ranges?) Ken Excel Discussion (Misc queries) 14 December 2nd 06 07:23 PM
How do I delete a macro in Excel 2003? Button is greyed out. mg Excel Discussion (Misc queries) 3 August 17th 06 12:23 AM
Delete specific text in spreadsheet SITCFanTN Excel Worksheet Functions 2 June 4th 06 02:12 AM
macro to insert row after specific text Luke Excel Discussion (Misc queries) 2 September 19th 05 04:06 PM
Macro data selection line delete Frantic Excel-er Excel Discussion (Misc queries) 0 May 31st 05 11:46 PM


All times are GMT +1. The time now is 08:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"