On sheet1 a1 I have a formula that pulls data from a different sheet. The formula is ='Web data'!d1. This is filled down to a400. The information that is on the Web data sheet is brought in by a query. When I refresh the query, the data that I need is not always in the same row, but IS always in the same column. What I was hoping to do was, copy the column from the query page, then run the macro to delete all the rows that have a 0 in them. In theory, this was supposed to delete all the rows with 0 and leave the 42 rows of data, the rows without 0. But what happens is it deletes evey other row. And it hangs up and I get an error msg when it hits row 256. What am I doing wrong?
Code:
Sub delete()
Application.ScreenUpdating = False
For n = 1 To 400
With Worksheets("Sheet1")
If .Cells(1, n) = "0" Then .Rows(n).delete
End With
Next n
Application.ScreenUpdating = True
End Sub