![]() |
Not empty but zero
I need the code to delete a record/row if cell Q (of that record/row) is 0. Not empty but 0 What would be the best way to achieve this? Thanks, Met -- Metrazal ------------------------------------------------------------------------ Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648 View this thread: http://www.excelforum.com/showthread...hreadid=515285 |
Not empty but zero
Try:
Sub RealZero() Dim iLastRow As Long Dim i As Long Dim rng As Range iLastRow = 65536 For i = 1 To iLastRow If Cells(i, 17).Value = 0 And Not IsEmpty(Cells(i, 17)) Then If rng Is Nothing Then Set rng = Rows(i) Else Set rng = Union(rng, Rows(i)) End If End If Next i If Not rng Is Nothing Then rng.Delete End If End Sub -- Gary's Student "Metrazal" wrote: I need the code to delete a record/row if cell Q (of that record/row) is 0. Not empty but 0 What would be the best way to achieve this? Thanks, Met -- Metrazal ------------------------------------------------------------------------ Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648 View this thread: http://www.excelforum.com/showthread...hreadid=515285 |
All times are GMT +1. The time now is 12:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com