Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Having difficulties with For If Next loops

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Having difficulties with For If Next loops

THANKS!!!

"Snake Plissken" wrote:

....
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if function difficulties [email protected] Excel Worksheet Functions 1 December 28th 07 07:15 PM
Keystroke Difficulties WOLLAM Excel Discussion (Misc queries) 3 July 22nd 06 07:10 AM
Difficulties with HYPERLINK mevetts Excel Discussion (Misc queries) 2 April 12th 06 08:13 PM
difficulties ernie Excel Discussion (Misc queries) 1 February 13th 06 08:39 PM
etyping difficulties Jean-Yves[_2_] Excel Programming 0 September 1st 04 11:28 AM


All times are GMT +1. The time now is 06:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"