Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete row if value is zero
I'm trying to create an if statement that will delete entire rows where the
value in Column N is less than .01 or efectively zero for my purposes. The little bit i've figured out will delete the row but only if the whole row is blank. If any one can help me all the better. Thank you, Karl |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete row if value is zero
======================
Option Explicit Sub step_backwards() Dim myLastRow As Long Dim r As Long Dim c As Range myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row For r = myLastRow To 1 Step -1 Set c = ActiveSheet.Range("a" & r) If c.Value = "" Then c.EntireRow.Delete End If Next r End Sub ========================= it looks for blanks in column A. change that if you need to. hope it helps :) susan On Jul 21, 10:05*am, KWhamill wrote: I'm trying to create an if statement that will delete entire rows where the value in Column N is less than .01 or efectively zero for my purposes. The little bit i've figured out will delete the row but only if the whole row is blank. If any one can help me all the better. Thank you, Karl |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete row if value is zero
ALWAYS post your efforts for comments
-- Don Guillett Microsoft MVP Excel SalesAid Software "KWhamill" wrote in message ... I'm trying to create an if statement that will delete entire rows where the value in Column N is less than .01 or efectively zero for my purposes. The little bit i've figured out will delete the row but only if the whole row is blank. If any one can help me all the better. Thank you, Karl |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete row if value is zero
Thank you that was great Now i see what i was doing wrong.
R, Karl "Susan" wrote: ====================== Option Explicit Sub step_backwards() Dim myLastRow As Long Dim r As Long Dim c As Range myLastRow = ActiveSheet.Cells(10000, 1).End(xlUp).Row For r = myLastRow To 1 Step -1 Set c = ActiveSheet.Range("a" & r) If c.Value = "" Then c.EntireRow.Delete End If Next r End Sub ========================= it looks for blanks in column A. change that if you need to. hope it helps :) susan On Jul 21, 10:05 am, KWhamill wrote: I'm trying to create an if statement that will delete entire rows where the value in Column N is less than .01 or efectively zero for my purposes. The little bit i've figured out will delete the row but only if the whole row is blank. If any one can help me all the better. Thank you, Karl |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |