LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Close file and run macro from newly opened file

i have an excelfile of 20 MB (due to lot of data which cannot be deleted). It
has a macro in which simulation is run. it involves generation of random
numbers and i need huge number of trials to get meaningful results. problem
is when i try to run simulation when this 20 MB file is open it takes very
high time, about 20 seconds for one simulation. however if i copy the sheet
containing simulation code and save that in separate file, close the original
20 MB file and now run the macro, the simulation time is very fast. less than
1 second for 1 simulation.i can't do manual copy of the sheet and closing the
original file for every time i run simulation (the 20 MB file has various
sheets and various parameters can be changed and simulation done for that
scenario).

the simulation code is there in the original 20 mb file (let's call it
original20.xls). there is a button which is linked to this macro. when i
click on this button simulation starts. what i want to do is as that when i
click on simulate button on the original20.xls file the following happens:

the sheet named simulate is copied.
the sheet is pasted in a new xls file.
original20.xls is closed.
the new xls file genrated is named as simulresults.xls
there will be same button in the new file. but the macro associated with
this button will refer to the original20.xls. macro association should be
changed to macro contained in simulresults.xls
now when i click simulate button, actual simulation process starts.

Can anybody please help.

thanks

pradip




 
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
How to run a macro automatically when the file is opened? LunaMoon Excel Discussion (Misc queries) 1 April 24th 10 01:01 AM
Book1 default - does not close once another file is opened MaryM New Users to Excel 1 February 22nd 09 03:49 AM
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
macro to retrieve path to opened file windsurferLA Excel Programming 3 February 17th 05 10:05 PM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"