Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default dual zero conditional row deletion

I want to set up a condition where a row is deleted ONLY if BOTH cells equal
zero. Currently the macro below delete the row when the first cell = zero.
Thus when there is something in the second cell and the first cell is zero
the row is deleted.

The code is below if someone could assist I would be greatful.

'
Sheets("Report").Select
Cells.Select
Selection.Copy
Sheets.Add
Cells.Select
ActiveSheet.Paste
Range("D11:H120").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Dim DeleteFlag As Boolean
DeleteFlag = True
While DeleteFlag = True
DeleteFlag = False
Range("A11:H120").Select
For Each rw In Selection.Rows
If rw.Cells(1, 4).Value = 0 And rw.Cells(1, 9) = 0 And
IsNumeric(rw.Cells(1, 1).Value) And Not IsEmpty(rw.Cells(1, 1)) Then
rw.Delete
DeleteFlag = True
'rw.Cells(1, 10).Value = "Zero"
End If
Next rw
Wend
Application.CutCopyMode = False
Range("D16").Select
ActiveWindow.Zoom = 85
Range("A3").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Name = Right(Trim(Selection.Value), 5)
Application.CutCopyMode = False
Range("A3").Select
Sheets("Macro1").Select
Range("C2").Select
Selection.Delete Shift:=xlUp
Sheets("Report").Select
Range("A3").Select
ActiveCell.FormulaR1C1 = "=Macro1!R[-1]C[2]"
Range("A3").Select
Sheets("Data").Select
Range("D4:E88").Select
Selection.ClearContents
End Sub

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
Help with Dual Conditional issue (sumif?) Acey Excel Discussion (Misc queries) 2 July 14th 09 10:26 AM
Automatic Conditional Row Deletion? Go Terps Excel Programming 12 April 23rd 08 05:48 PM
Conditional Deletion Seeking help[_3_] Excel Programming 3 June 28th 06 06:19 AM
Conditional deletion of rows AussieExcelUser[_2_] Excel Programming 4 June 16th 06 02:43 AM
Conditional Row Deletion Kirk P. Excel Programming 4 November 3rd 05 07:58 PM


All times are GMT +1. The time now is 03:07 AM.

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"