View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bill Martin[_2_] Bill Martin[_2_] is offline
external usenet poster
 
Posts: 105
Default How do you run macro automatically each time workbook is saved?

Bill Martin wrote:
Husker87 wrote:

I have a macro that copies some data to another worksheet in the workbook.
It copies the data as values only. (Some of the date in the first worksheet
is result of formulas and I just want the data to be copied) Anyway, how can
I run the macro each time the workbook is saved so that the second worksheet
always has update data in it? Any ideas?



-------------------

You need to write an event driven macro which will call the other routine that
does your actual work. Look in Walkenbach's VBA book, pg 616 for the
"BeforeSave" event and a code example that just a few lines long. I'd reproduce
it here for you, but it's obviously copyrighted.

Bill

--------------------

Actually, to avoid a trip to the library there are links on the web you can find
with a Google search on Excel and BeforeSave, or use Google to search this board
for the BeforeSave event. Here are a couple of the links:

http://msdn2.microsoft.com/en-us/lib...eforesave.aspx

http://www.mvps.org/dmcritchie/excel...htm#beforesave

Good luck...

Bill