Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and delete | Excel Worksheet Functions | |||
Find and delete! | Excel Discussion (Misc queries) | |||
Find and Delete | Excel Worksheet Functions | |||
find row and delete | Excel Discussion (Misc queries) | |||
Find delete | Excel Discussion (Misc queries) |