Private Sub Deleterows_Click()
x = 1
y = 1
Cells(x, y).Select
Do
If Cells(x, y).Value = 0 Then
Cells(x, y).EntireRow.Delete
x = x - 1
End If
x = x + 1
Loop Until Cells(x, y) = ""
End Sub
This is the code I have assigned to a command button which checks if there are any zeros typed in column A. If any zeros or should I say 0 is found in the cell, the macro deletes the entire row. This seems to work fine in one of the workbooks I have designed. I am using the same technique and it does not seem to work in another workbook. There is no error message, the macro runs , but does not do any checking or deletion, the cursor simply selects Cell A1 of the workbook and stays there.
Is there another way of solving this problem.
If column A has any 0 then that row should be entirely deleted.
Can anyone please help me.!!
Greta
x = 1
y = 1
Cells(x, y).Select
Do
If Cells(x, y).Value = 0 Then
Cells(x, y).EntireRow.Delete
x = x - 1
End If
x = x + 1
Loop Until Cells(x, y) = ""
End Sub
This is the code I have assigned to a command button which checks if there are any zeros typed in column A. If any zeros or should I say 0 is found in the cell, the macro deletes the entire row. This seems to work fine in one of the workbooks I have designed. I am using the same technique and it does not seem to work in another workbook. There is no error message, the macro runs , but does not do any checking or deletion, the cursor simply selects Cell A1 of the workbook and stays there.
Is there another way of solving this problem.
If column A has any 0 then that row should be entirely deleted.
Can anyone please help me.!!
Greta