View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default application run problem?

Hi John,

A few things to check:

1) Are any of your subroutines selecting or activating ranges or worksheets?
Do any of them use ActiveCell or ActiveSheet? If so, you may get unexpected
results by running them all in a row like this. Instead of selecting
objects and using relative references, you should try to use fully-qualified
ranges when copying/pasting. For example, instead of this:

Worksheets("Sheet1").Select
Range("A1").Select
ActiveCell.Copy
Worksheets("Sheet2").Select
Range("A1").Select
ActiveCell.Paste

You should do this:

Worksheets("Sheet1").Range("A1").Copy Destination:= _
Worksheets("Sheet2").Range("A1")


2) Maybe you're running into timing issues (not likely, but possible I
suppose). If #1 doesn't hold true, then you could try putting DoEvents
between each Application.Run to see if your problems clear up.


3) If neither #1 or #2 work, try putting a breakpoint on the first line of
code and step through it line by line to see where you might be going wrong.


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


John wrote:
I have the following code which runs several macros... the macros are
to cut and paste certian values into different sheets... and each
macro runs fine on its own. However, when I run all of them together
many of the values that should be cut and pasted are not... any ideas?

Application.Run "'SNW Sales Credit Summary.xls'!SA"
Application.Run "'SNW Sales Credit Summary.xls'!NI"
Application.Run "'SNW Sales Credit Summary.xls'!DN"
Application.Run "'SNW Sales Credit Summary.xls'!SC"
Application.Run "'SNW Sales Credit Summary.xls'!CP"
Application.Run "'SNW Sales Credit Summary.xls'!ST"
Application.Run "'SNW Sales Credit Summary.xls'!ARS"
Application.Run "'SNW Sales Credit Summary.xls'!DAN_FUT"
Application.Run "'SNW Sales Credit Summary.xls'!BUZ_DN"
Application.Run "'SNW Sales Credit Summary.xls'!TA"
Application.Run "'SNW Sales Credit Summary.xls'!TAT"
Application.Run "'SNW Sales Credit Summary.xls'!DA"
Application.Run "'SNW Sales Credit Summary.xls'!TC"
Application.Run "'SNW Sales Credit Summary.xls'!TM"
Application.Run "'SNW Sales Credit Summary.xls'!TMT"
Application.Run "'SNW Sales Credit Summary.xls'!TCT"
Application.Run "'SNW Sales Credit Summary.xls'!UST"
Range("A1").Select