LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Delete Row If Cell Does Not Contain "text"

Sub Delete_Row()
'looks only at Column A
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 1).Value < "Bad" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub


Gord Dibben MS Excel MVP


On Tue, 6 May 2008 11:20:08 -0700, Cue wrote:

I'm tring to delete a row that has a cell that contains words but does not
contain a specific "text".

Ex. Cell A2 = Jill - Good

I want to delete Row 2 becasue Cell A2 does not contain "Bad". The Macro is
following:

Sub Delete Row()

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 3).Value < "text" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub

Can somebody show me what is missing or needed to accomplish this?


 
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
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
Macro to Replace/Delete Text Using "Watchword" List? PBJ Excel Discussion (Misc queries) 10 June 29th 07 09:50 PM
USING EXCEL, delete all text right of the "!" symbol Boyd Excel Worksheet Functions 5 September 23rd 06 07:52 PM
Excel: Changing "numeric $" to "text $" in a different cell. Heather_CCF Excel Worksheet Functions 1 September 5th 06 06:06 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 12:35 AM.

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

About Us

"It's about Microsoft Excel"