Thread: Macro problem
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
PE PE is offline
external usenet poster
 
Posts: 14
Default Macro problem

There are no merged cells in the column but the top cell in the column is
merged with four on the left.

I have unmerged all the cells but still the macro gets interrupted.

"Tom Ogilvy" wrote in message
...
Your code ran fine for me (functionally I can't say, but it didn't error).
Do you have any merged cells in the column you are processing?

--
Regards,
Tom Ogilvy



"PE" wrote:

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