Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If a cell contains a certain value, I want to delete the row it is in, e.g.,
if cell K2 has value 0 then delete row 2 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Public Sub ProcessData()
Const TEST_COLUMN As String = "K" '<=== change to suit Dim i As Long Dim iLastRow As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = iLastRow to 1 Step -1 If .cells(i, TEST_COLUMN).Value = 0 Then .Rows(i).Delete End If Next i End With End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "GKW in GA" wrote in message ... If a cell contains a certain value, I want to delete the row it is in, e.g., if cell K2 has value 0 then delete row 2 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I conditionally delete rows based on cell contents? | Excel Worksheet Functions | |||
Is there a way to delete a cell value based on a condition? | Excel Discussion (Misc queries) | |||
Delete Row based off cell content | Excel Discussion (Misc queries) | |||
Delete row based on contents of cell | Excel Discussion (Misc queries) | |||
Delete record(s) in other cells based on value of one cell. | Excel Discussion (Misc queries) |