View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myriam Myriam is offline
external usenet poster
 
Posts: 97
Default AutoRun a macro on Closing

Hi,
You can use
Private Sub Workbook_BeforeClose (Cancel as Boolean)

.... your code...

End sub

"mrbalaje" wrote:

I have recorded a macro. Macro coding given below. All I want to autorun this
macro whenever I close the spreadsheet.



Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/22/2007 by balaje.rangachari
'
' Keyboard Shortcut: Ctrl+Shift+P
'
Range("C6:C13").Select
Selection.Copy
Range("A6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C15").Select
Application.CutCopyMode = False
End Sub