Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey there,
I am trying to have my marco delete all rows with a value equal to or less then 0 (in a particular field). Any help would be great. Thanks, -- Damon |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sort them first (programmatically if you wish - do a macro record to
see how), then do a find for zero, then delete all rows below. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
James,
I think that will work. Thank you very much. I will try that right now. -- Damon "james" wrote: Sort them first (programmatically if you wish - do a macro record to see how), then do a find for zero, then delete all rows below. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Damon.
Try: Sub Cancellariga() Dim R As Long Dim LR As Long With ActiveSheet LR = .Cells(Rows.Count, 1).End(xlUp).Row For R = LR To 1 Step -1 If .Cells(R, 1).Value = 0 Then .Cells(R, 1).EntireRow.Delete End If Next End With End Sub Regards Eliano On 4 Giu, 00:59, Damon wrote: Hey there, I am trying to have my marco delete all rows with a value equal to or less then 0 (in a particular field). *Any help would be great. Thanks, -- Damon |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub DeleteRows()
Dim iLastRow As Long Dim I As Long iLastRow = Cells(Rows.Count, "C").End(xlUp).Row For I = iLastRow To 1 Step -1 If Cells(I, "C").Value <= 0 Then Rows(I).Delete End If Next I End Sub Edit the "C" to suit. Gord Dibben MS Excel MVP On Tue, 3 Jun 2008 15:59:02 -0700, Damon wrote: Hey there, I am trying to have my marco delete all rows with a value equal to or less then 0 (in a particular field). Any help would be great. Thanks, |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry Damon, ut i forget the minus sign.
If .Cells(R, 1).Value = 0 Then is intended as: If .Cells(R, 1).Value <= 0 Then Eliano |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro for Copying with conditions | Excel Discussion (Misc queries) | |||
macro for excel msg pop up when certain conditions are met | Excel Discussion (Misc queries) | |||
Macro help: VLOOKUP with conditions | Excel Programming | |||
using IF and AND conditions in a macro | Excel Programming | |||
Need continuously running macro when conditions are met | Excel Programming |