No selecting needed.
You indicate to clear, not delete, cells with a zero (0). I don't think you have to worry about clearing blank cells.
One possibility:
This will replace all zeros on the whole sheet.
Sub Replace_Zeros()
With Sheets("Sheet2").UsedRange '<---- Change as required
.Replace 0, "", xlWhole
End With
End Sub
If you want to delete cells, maybe up or left, that would be a different story
This will delete the Cells with a Zero (0) and shift up.
Sub Delete_Cells_Up()
Dim lc As Long, lr As Long, i As Long, j As Long
lc = Cells.Find("*", , , , xlByColumns, xlPrevious).Column
lr = Cells.Find("*", , , , xlByRows, xlPrevious).Row
Application.ScreenUpdating = False
For j = 1 To lc
For i = lr To 1 Step -1
If Cells(i, j).Value = 0 Then Cells(i, j).Delete Shift:=xlUp
Next i
Next j
Application.ScreenUpdating = True
End Sub
This will delete the Zeros and shift blank Cells up.
Sub Delete_Zeros_And_Blanks()
Application.ScreenUpdating = False
With Sheets("Sheet2").UsedRange '<---- Change as required
.Replace 0, "", xlWhole
.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
End With
Application.ScreenUpdating = True
End Sub
Bookmarks