or just a little bit neater Sub MtestSAS() Application.ScreenUpdating = False For i =cells(rows.count,āPā).end(xlup).row To 1 Step -1 If Cells(i, 16).Value = 0 Then rows(i).Delete Next i Application.ScreenUpdating = True End Sub
From: Mahesh parab Sent: Thursday, August 11, 2011 1:15 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ ***Macro Code Required to delete Zero value cell and its row*** Hi Prabhu Try Sub Mtest() Dim LR As Long, i As Long LR = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count 'LR = Range("P" & Rows.Count).End(xlUp).Row Application.ScreenUpdating = False For i = LR To 1 Step -1 If Cells(i, 16).Value = 0 Then Cells(i, 16).EntireRow.Delete Next i Application.ScreenUpdating = True End Sub OR Sub Mtest1() Dim LR As Long, r As Long LR = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count Application.ScreenUpdating = False For r = LR To 1 Step -1 If Application.WorksheetFunction.CountIf(Cells(r, 16), "=0") = 1 Then Rows(r).Delete Next r Application.ScreenUpdating = True End Sub Thanks Mahesh On Thu, Aug 11, 2011 at 10:00 PM, Prabhu <prabhugate...@gmail.com> wrote: Hi Mahesh, It is deleting entire row wherever zero appearing. But i required in a partiuclar column if Zero value found we need to delete entire row. Ex. If we use base as "P" column, In 13th row of "P" column contains "0" value it has to delete entire 13th Row. It should not search other columns. Regards, Prabhu -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel