Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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
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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. Corey Excel Programming 3 December 11th 06 05:14 AM
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
Excel code convert to Access code - Concat & eliminate duplicates italia Excel Programming 1 September 12th 06 12:14 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 10:06 PM.

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"