View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Allllen Allllen is offline
external usenet poster
 
Posts: 341
Default Delete entire row with a positive number

Explanation:

Cells(row,column)
You have Cells(row, i), so i represents your column.
You just have to put it the other way around to sift through rows.

Solution:

Sub click()
Dim i As Integer
Sheet1.Select
Sheet1.Range("a2:b5").Select '<-You probably don't need this line of code
For i = 2 To 6 '<-Are you sure it is to 6 and not 5?
Cells(i, 2).Select '<-CHANGED, but also try it without this
line of code
If Sheet1.Cells(i, 2) 0 Then Sheet1.Rows(i).Delete '<-CHANGED
Next i
End Sub




--
Allllen


"marthasanchez" wrote:

How do I delete an enitre row based on one columns number. For example, if
column A has a 5 then the entire row should be deleted and the formula move
to the next row.
This is what i have, but it is siftong through columns.

Sub click()
Dim i As Integer
Sheet1.Select
Sheet1.Range("a2:b5").Select
For i = 2 To 6
Cells(2, i).Select
If Sheet1.Cells(2, i) 0 Then Sheet1.Rows(i).Delete
Next i
End Sub

PLEASE HELP