Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro problem
I am trying to write a macro which would:
1) check the cell to the left - if value is 0 (or cell is empty) then macro is abandoned else...... 2) if current cell is non-empty then the row is deleted and back to 1) to check the next row 3) if current cell is empty then move down 1 cell and back to 1) I have tried the following: Sub DeleteRow_If_Cell_NotEmpty() Do If ActiveCell.Offset(0, -1).Value 0 Then If ActiveCell < "" Then Selection.EntireRow.Delete Else 'go to next row ActiveCell.Offset(1, 0).Select End If Else Exit Sub End If Loop End Sub If I step into the macro using F8 in VB editor it works fine. But when I use the macro normally I get the error "Code execution has been interrupted" and on clicking the debug button the first End If above is highlighted. Would appreciate your help. Al |
Thread Tools | Search this Thread |
Display Modes | |
|
|