Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Entire Row
Okay, I'm stumped. Here is what I want to do:
Colum F contains inventory quantities. I want to delete all rows where inventory numbers in column F are 0. I know there is a way to do this but I can't seem to figure it out. Any help is much appreciated as always! Tony P. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Entire Row
Use autofilter and then custom. Here you can filter all values 0 and then
delete the rows or use the following code to do it Columns("A:A").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="0", Operator:=xlAnd Set rng = Range("a1").CurrentRegion rng.Offset(1, 0).Resize(rng.Rows.Count - 1, _ rng.Columns.Count).Select Selection.EntireRow.Delete "Tony P." schreef: Okay, I'm stumped. Here is what I want to do: Colum F contains inventory quantities. I want to delete all rows where inventory numbers in column F are 0. I know there is a way to do this but I can't seem to figure it out. Any help is much appreciated as always! Tony P. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Entire Row
Hi Tony
Here is a example for row 1 -100 Sub Example2() Dim Lrow As Long Dim CalcMode As Long Dim StartRow As Long Dim EndRow As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With With ActiveSheet .DisplayPageBreaks = False StartRow = 1 EndRow = 100 For Lrow = EndRow To StartRow Step -1 If IsError(.Cells(Lrow, "F").Value) Then 'Do nothing, This avoid a error if there is a error in the cell ElseIf .Cells(Lrow, "F").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 "Tony P." wrote in message ... Okay, I'm stumped. Here is what I want to do: Colum F contains inventory quantities. I want to delete all rows where inventory numbers in column F are 0. I know there is a way to do this but I can't seem to figure it out. Any help is much appreciated as always! Tony P. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Entire Row
Never thought of using the filter. Beautiful! Thanks!
"Brotha lee" wrote: Use autofilter and then custom. Here you can filter all values 0 and then delete the rows or use the following code to do it Columns("A:A").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="0", Operator:=xlAnd Set rng = Range("a1").CurrentRegion rng.Offset(1, 0).Resize(rng.Rows.Count - 1, _ rng.Columns.Count).Select Selection.EntireRow.Delete "Tony P." schreef: Okay, I'm stumped. Here is what I want to do: Colum F contains inventory quantities. I want to delete all rows where inventory numbers in column F are 0. I know there is a way to do this but I can't seem to figure it out. Any help is much appreciated as always! Tony P. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete an entire row | Excel Discussion (Misc queries) | |||
Delete entire row if | Excel Discussion (Misc queries) | |||
Delete Entire Row If Q | Excel Programming | |||
Another delete entire row | Excel Programming | |||
Delete Entire Row. | Excel Programming |