Having difficulties with For If Next loops
....
Else
Run "Cleanup"
exit for
End If
Hey all, ive been designing vba in excel for about 1 year now, and one
commone problem I run into is in for if next loops when they appear in a
long
chain of macros. so here is what I have
Sub Resume_Cleanup2()
For Each Cell In Selection
If ActiveCell = "A" Or (ActiveCell < "US96" And ActiveCell <
"CA96") Then
ActiveCell.EntireRow.Delete shift:=xlUp
Else
Run "Cleanup"
End If
Next Cell
End Sub
So what the problem is, the macro will run cleanup, and in cleanup I save
and use applicatin.quit, however when you run the macro it does not quit
at
cleanup. Instead it bounces back and starts running the last peice of
Resume_Cleanup2. Is there a way to stop this? I really would like my
closing
statements to appear at the end in the chain of macros instead of the
middle.
Also, where and how should end if statements appear? It doesnt always
seem
to me they work the same in the different places.
|