Do I have superfluous code?

A

Arnie

The code below is in a workbook called "Data Storage and Retrieval" which
recieves copied worksheets from another "Data Collection" workbook. To avoid
the runtime error involved with continuously copying worksheets without
closing the workbook I have some OnTime timers to save and copy both
workbooks. My question is: after the line of code below closes the workbook
it came from (Data Storage and Retrieval) is the rest of the code executed
since Excel is still open or is the routine ended at that point (in which
case I don't need the following lines of code)?

Thanks.

Sub Storage()
Application.Run "'DATA STORAGE AND RETRIEVAL.xls'!StopTimer_Store"
Application.Run "'DATA COLLECTION.xls'!StopTimer_Collect"

WaitTime1 = Now + TimeValue("0:00:03")
Application.Wait WaitTime1

Application.DisplayAlerts = False

Workbooks("DATA COLLECTION").SaveAs ("P:\Bowling Green\QA DATA\QA DATA
COLLECTION\DATA COLLECTION.xls")
Workbooks("DATA COLLECTION").Close SaveChange = False
Workbooks("DATA STORAGE AND RETRIEVAL").SaveAs ("P:\Bowling Green\QA
DATA\QA DATA COLLECTION\DATA STORAGE AND RETRIEVAL.xls")
Workbooks.Open ("P:\Bowling Green\QA DATA\QA DATA COLLECTION\DATA
COLLECTION.xls")
Workbooks("DATA STORAGE AND RETRIEVAL").Close SaveChange = False
Application.DisplayAlerts = True

Application.Run "'DATA COLLECTION.xls'!StartTimer_Collect"
Application.Run "'DATA STORAGE AND RETRIEVAL.xls'!StartTimer_Store"
End Sub
 
J

Joel

I can't tell which workbook the macro is running. If you close the worksheet
that is running a macro the macro stops running. close overides the
completion of running a macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top