VBA to delete a row based on rows being filled.

J

jlclyde

Here is my code. I move information from one sheet to another. This
part works fine. I then woudl like to delete rows if there is nothing
in columns J, M, S, and V. Someone had given me the code to go
through the sheet. Hopefully someone can help me.

Jay

Sub Offset()
Dim myCount As Integer
Dim NextRow As Long
Dim Datei As Date

Datei = Range("E1")

Range("A7:C26, V7:Am26, Bm7:Bp26").Copy
Application.ScreenUpdating = False
Workbooks.Open Filename:="G:\DPE-IPE\DPE REVISIONS\All Press Ips.xls"
NextRow = Range("D65536").End(xlUp).Row + 1

Sheets("Offset").Range("D" & NextRow).PasteSpecial
Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Dim i As Long
With Sheets("Offset")
' Loop through the rows
For i = 1 To .Cells.SpecialCells(xlCellTypeLastCell).Row
' Test cells in columns J, M, S &V
If .Cells(i, 10).Value = "0" And .Cells(i, 13).Value = "0"
And .Cells(i, 19).Value = "0" _
And .Cells(i, 22).Value = "0" Then .Cells(i,
1).EntireRow.Delete
Next i
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top