ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Q: delete rows (https://www.excelbanter.com/excel-discussion-misc-queries/43450-q-delete-rows.html)

JIM.H.

Q: delete rows
 
Hello,

I have an excel file and I want to write a macro that delete all the rows
if D,E,F columns have zero values.
Can anyone give me a code for this?
Thanks,


David Hepner

This code is designed to delete the row if the columns D,E and F have a 0
value (not a blank).


Sub Macro1()
Dim i As Long
Dim c As Integer
c = 0
Application.ScreenUpdating = False

For i = 1 To 65536
If Range("D" & i).Value = c And Range("E" & i).Value = c And Range("F" &
i).Value = c Then
Rows(i & ":" & i).Select
Selection.Delete Shift:=xlUp
End If

Next i

Application.ScreenUpdating = True

End Sub






"JIM.H." wrote:

Hello,

I have an excel file and I want to write a macro that delete all the rows
if D,E,F columns have zero values.
Can anyone give me a code for this?
Thanks,



All times are GMT +1. The time now is 08:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com