View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Robert Robert is offline
external usenet poster
 
Posts: 113
Default Deleting rows dependent upon cell contents

Try this. Rename your sheet to PWR. I have deliberately set rows range 2 to
65535.

Dim i%, rng As Range
Set rng = Worksheets("PWR").Cells(1, 4)
For i = 2 To 65535
If Worksheets("PWR").Cells(i, 4) = "0" Then
Set rng = Union(rng, Worksheets("PWR").Cells(i, 4))
End If
Next i
rng.Rows.EntireRow.Delete

End Sub

--
Robert


"daedalus1" wrote:

Hi,

I have a spreadsheet of 5 columns and 65536 rows, the columns a date,
time, flow rate m3/hr, power kWh, pressure bar. Some of the rows have
redundent information when the unit is turned off so in the kWh column I will
have values of 0. I want to delete these rows from the data. What is the
easiest way to do this? I cannot be bothered going down all the rows and
finding the instances where the kWh is 0 on an individual basis.
--
daedalus1