Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 84
Default Find and Delete Row

Need some help...

I'm trying to find ANY text in a column and then delete the entire row. In other words, if there is text in B3, B8, B16, etc., I want to find the macro to find it and then delete the rows 3, 8, 16, etc. These are not actual rows, just examples. I tried the following macro but it doesn't work. I tried to use a wildcard character to locate text in column B because that text is not a constant. I think I'm close but I need this to be corrected.

Thanks for your help.

Sub Delete_Zero_Rows()
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For r = lastrow To 1 Step -1
If Cells(r, "B") = (item*) Then
Rows(r).EntireRow.Delete
End If
Next r
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Find and Delete Row

Sub Delete_Zero_Rows()
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For r = lastrow To 1 Step -1
If Application.WorksheetFunction.IsText(Cells(r, "B")) Then
Rows(r).EntireRow.Delete
End If
Next r
End Sub
--
Gary''s Student - gsnu200750


"Keyrookie" wrote:


Need some help...

I'm trying to find ANY text in a column and then delete the entire row.
In other words, if there is text in B3, B8, B16, etc., I want to find
the macro to find it and then delete the rows 3, 8, 16, etc. These are
not actual rows, just examples. I tried the following macro but it
doesn't work. I tried to use a wildcard character to locate text in
column B because that text is not a constant. I think I'm close but I
need this to be corrected.

Thanks for your help.

Sub Delete_Zero_Rows()
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For r = lastrow To 1 Step -1
If Cells(r, "B") = (item*) Then
Rows(r).EntireRow.Delete
End If
Next r
End Sub




--
Keyrookie

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
Find and delete Philip Drury Excel Worksheet Functions 3 October 4th 07 07:33 PM
Find and delete! Philip Drury Excel Discussion (Misc queries) 0 October 3rd 07 02:36 PM
Find and Delete Karen[_2_] Excel Worksheet Functions 2 June 19th 07 11:04 PM
find row and delete Native Excel Discussion (Misc queries) 2 February 2nd 05 09:46 PM
Find delete Jean-Francois Excel Discussion (Misc queries) 3 January 11th 05 05:25 PM


All times are GMT +1. The time now is 01:28 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"