View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default DELETE CELL OF ZERO VALUE

Hi,

Right click your sheet tab, view code and paste this in and run it

Sub stance()
Dim copyrange As Range
lastrow = Cells(Cells.Rows.Count, "L").End(xlUp).Row
Set myrange = Range("H2:H" & lastrow)
For Each c In myrange
If Not IsEmpty(c.Offset(, 4)) And c.Offset(, 4).Value = 0 Then
If copyrange Is Nothing Then
Set copyrange = c.Resize(, 6)
Else
Set copyrange = Union(copyrange, c.Resize(, 6))
End If
End If
Next

If Not copyrange Is Nothing Then
copyrange.Delete Shift:=xlUp
End If
End Sub

Mike

"K" wrote:

Hi all, I want macro that if any cell in range L2 to last value cell
in column L have zero value then row from column H to M of that cell
should be deleted (Delete Shift:= xlUP)
Please can anybody help.