I leave this very little one...

mariomenc

New Member
Joined
Aug 25, 2005
Messages
26
I know this question for all of you is real easy, I want to run a macro when I close the file. I know this is possible and I'll like to somebody tell me how.


Thanks
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

At the top left of the spreadsheet, immediately to the left of File on the toolbar, right click o the spreadsheet icon, select view code. There are 2 dropdowns and the left one should default to general. Select the drop down, and take workbook. On the right dropdown, select before_close. Put in your macro and it will run before the spreadsheet is closed.


HTH

Tony
 

krazykaj

Board Regular
Joined
Jul 20, 2005
Messages
143
Hi, Just put this into you Workbook code:

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

End Sub

Put whatever you want in between :)

Hope that helps and is what you were after,
Cheers
KJ
 

Watch MrExcel Video

Forum statistics

Threads
1,118,057
Messages
5,569,954
Members
412,299
Latest member
agentless
Top