Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
I need the code that will Delete the entire row if the
cell in Column I is equal to zero. I need it to go down the whole column. Can anyone help me out? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
Hi
try the following macro: Sub delete_rows() Dim lastrow As Long Dim row_index As Long Application.ScreenUpdating = False lastrow = ActiveSheet.Cells(Rows.Count, "I").End(xlUp).Row For row_index = lastrow - 1 To 1 Step -1 If Cells(row_index, "I").Value = 0 then rows(row_index).delete End If Next Application.ScreenUpdating = True End Sub also have a look at: http://www.xldynamic.com/source/xld.Deleting.html -- Regards Frank Kabel Frankfurt, Germany wrote: I need the code that will Delete the entire row if the cell in Column I is equal to zero. I need it to go down the whole column. Can anyone help me out? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro
Try this for column I
Sub Example1() Dim Firstrow As Long Dim Lastrow As Long Dim Lrow As Long Dim CalcMode As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With Firstrow = ActiveSheet.UsedRange.Cells(1).Row Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1 With ActiveSheet .DisplayPageBreaks = False For Lrow = Lastrow To Firstrow Step -1 If IsError(.Cells(Lrow, "I").Value) Then 'Do nothing, This avoid a error if there is a error in the cell ElseIf .Cells(Lrow, "I").Value = "0" Then .Rows(Lrow).Delete End If Next End With With Application .ScreenUpdating = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl wrote in message ... I need the code that will Delete the entire row if the cell in Column I is equal to zero. I need it to go down the whole column. Can anyone help me out? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |