Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default AutoRun a macro on Closing

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

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
Autorun macro Josh Excel Discussion (Misc queries) 2 August 16th 09 02:19 PM
AutoRun Macro chrisnsmith Excel Worksheet Functions 5 February 4th 09 07:25 PM
Autorun macro Kelly Excel Worksheet Functions 1 January 18th 06 04:03 PM
MACRO AUTORUN b52shut Excel Discussion (Misc queries) 1 December 15th 05 08:48 AM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM


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

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"