Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Do I have superfluous code?
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 -- n00b lookn for a handout :) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Do I have superfluous code?
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. "Arnie" wrote: 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 -- n00b lookn for a handout :) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Do I have superfluous code?
Thanks Joel.
I believe I need to clean up a lot of un-needed lines. -- n00b lookn for a handout :) "Joel" wrote: 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. "Arnie" wrote: 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 -- n00b lookn for a handout :) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming |