PC Review


Reply
Thread Tools Rate Thread

AutoRun a macro on Closing

 
 
=?Utf-8?B?bXJiYWxhamU=?=
Guest
Posts: n/a
 
      22nd Mar 2007
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 With Quote
 
 
 
 
=?Utf-8?B?TXlyaWFt?=
Guest
Posts: n/a
 
      22nd Mar 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Microsoft Excel Programming 3 20th Oct 2011 09:01 PM
Autorun macro alpercet@gmail.com Microsoft Access 2 28th Dec 2006 01:33 PM
Autorun macro =?Utf-8?B?U2Nod2Fyeg==?= Microsoft Access Macros 2 1st Sep 2006 05:52 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Microsoft Excel Programming 2 25th May 2004 06:59 PM
Autorun a macro Nigel Chapman Microsoft Excel Programming 1 4th Feb 2004 01:02 PM


Features
 

Advertising
 

Newsgroups
 


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