I have a set of macros where...
Macro X calls a set of other macros, say Macro A, then Macro B and then Macro C Macro B is a Do / Loop macro, and ends with the command If z > 20 Then End Independently Macro B runs nicely, and independently so does Macro C. However if you call Macro B, then straight away, Macro C, then Macro C does not run. I guess the ending in Macro B is not ideal. Any ideas on a better way to end, keeping it simple please ??!! If you want the full code here it is..... Sub run_all() Call create_start_time Call F2_edit_spec Call create_finish_time End Sub Sub create_start_time() Dim A As Date 'variable A = start clock A = Now Range("D2").Select ActiveCell.Value = A End Sub Sub F2_edit_spec() Range("F1").Select Do x = ActiveCell.Value ActiveCell.Value = x ActiveCell.Offset(1, 0).Select z = ActiveCell.Row If z > 20 Then End Loop End Sub Sub create_finish_time() Dim B As Date 'variable B = stop clock B = Now Range("D3").Select ActiveCell.Value = B End Sub |
Change the End in the loop for an Exit Sub (if somethingorother>number then Exit Sub). The loop could be nicer ;) but it should work with an Exit Sub.
Cheers, Richie. |
Er, change it for an Exit Loop *hits head*
Richie. |
|
lmao yep it is :D *hits head again*
Richie. |
So instead of
If z > 20 Then End use If z > 20 Then Exit Do ?? [Edited by velohead66 - 5/13/2003 7:42:17 PM] |
yep :D
Richie. |
Tried it at work today, but used "Then Exit Sub" by mistake (poor memory).
It actually worked like a dream. Sound !! Ta. |
All times are GMT +1. The time now is 11:50 AM. |
© 2024 MH Sub I, LLC dba Internet Brands