Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete an entire row One-Leg Excel Discussion (Misc queries) 13 November 11th 08 08:27 PM
Delete entire row if David T Excel Discussion (Misc queries) 2 December 6th 06 10:14 PM
Delete Entire Row If Q John Excel Programming 10 June 9th 04 03:02 PM
Another delete entire row Sean[_9_] Excel Programming 1 May 11th 04 04:41 PM
Delete Entire Row. Sam Excel Programming 5 December 21st 03 05:56 AM


All times are GMT +1. The time now is 11:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"