Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm trying create a macros that will delete the entire row if the values in
cells T26 , U26, V26, and W26 are all 0. My macro is deleting all the rows even if the values of the cells are not 0. Can anyone tweak my code ? Dim lastrow As Long Dim r As Long lastrow = Range("T" & Rows.Count).End(xlUp).Row For r = lastrow To 2 Step -1 If (InStr(1, Cells(r, 20).Value) And (InStr(1, Cells(r, 21).Value) And _ InStr(1, Cells(r, 23).Value) And InStr(1, Cells(r, 24).Value))) = 0 Then ActiveSheet.Rows(r).EntireRow.Delete End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I delete an entire row if condition is not met? | Excel Worksheet Functions | |||
Easiest way to delete blank cells in column (not entire row) | Excel Discussion (Misc queries) | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
can I delete entire row if adjacent cell formats differ? | Excel Worksheet Functions | |||
How to delete blank rows | Excel Discussion (Misc queries) |