I have the following in Excel spreadsheet,

How do I delete a row based on the published within the J column = 0?
It would be better to cut the row and paste it within another sheet.. but IF you can help me with just deleting it, that would be good.
I have the following in Excel spreadsheet,

How do I delete a row based on the published within the J column = 0?
It would be better to cut the row and paste it within another sheet.. but IF you can help me with just deleting it, that would be good.
Sub Delete_Zero_Codes() ' Deletes The Zero Codes
Dim rCell As Range
Dim strAddress As String
Application.ScreenUpdating = False
With Thisworkbook.Sheets("sheetname").Columns("J")
Set rCell = .Find(What:=0, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns)
If Not rCell Is Nothing Then
Do
strAddress = rCell.Address
rCell.EntireRow.Delete
Set rCell = .FindNext(Range(strAddress))
Loop Until rCell Is Nothing
End If
End With
Application.ScreenUpdating = True
End Sub
These macro deletes zero codes of J column and does not paste them to other sheet, if you need zero codes of J column to be copied to other sheet then let me know i will update it
This code autofilters the rows on the activesheet where J =0, copies them to the first blank row on the second worksheet, then deletes the rows from the activesheet.
Change this line Set ws2 = Sheets(2) to copy the rows to a different sheet, ie Set ws2 = Sheets("Your Sheet Name") or Set ws2 = Sheets(5) for the fifth sheet etc
Sub MoveEm()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = ActiveSheet
Set ws2 = Sheets(2)
Dim rng1 As Range
Application.ScreenUpdating = False
With ws1
.AutoFilterMode = False
.Columns("j").AutoFilter Field:=1, Criteria1:="0"
With .AutoFilter.Range.Offset(1, 0).EntireRow
Set rng1 = ws2.Cells.Find("*", ws2.[a1], xlValues, , xlRows, xlPrevious)
If rng1 Is Nothing Then
Set rng1 = ws2.[a1]
Else
Set rng1 = ws2.Cells(rng1.Row + 1, "A")
End If
.Copy rng1
.Delete
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True
End Sub