Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a 50 files and I want it to run a macro to copy and paste to new
sheet in the file on closing the document. Is there a code to run this process. thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please do not repost the same Q (in the same words OR other words)!!!
See the reply in your other post. -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your description leaves ambiguity as to what your needs are.
Do you want to loop through each of 50 files, copy something, insert a new sheet and paste then close, presumably after saving? Or just need code in each workbook that runs on closing that workbook? Gord On Sat, 28 Jan 2012 09:51:51 -0700, "Fawn Lagimodiere" wrote: I have a 50 files and I want it to run a macro to copy and paste to new sheet in the file on closing the document. Is there a code to run this process. thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fawn Lagimodiere wrote:
I have a 50 files and I want it to run a macro to copy and paste to new sheet in the file on closing the document. Is there a code to run this process. As Garry said, the copying problem is already addressed. To run code when a workbook closes, open the workbook's class in the VBA editor and add this sub: Private Sub Workbook_BeforeClose(Cancel As Boolean) 'your code here End Sub -- I believe the official cause was listed as "death from superior firepower". |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Taking your subject heading of "run macro on close" literally.
Private Sub Workbook_BeforeClose(Cancel As Boolean) code to copy, insert and paste Thisworkbook.save End Sub Entered in Thisworkbook module. Gord On Sat, 28 Jan 2012 09:31:09 -0800, Gord Dibben wrote: Your description leaves ambiguity as to what your needs are. Do you want to loop through each of 50 files, copy something, insert a new sheet and paste then close, presumably after saving? Or just need code in each workbook that runs on closing that workbook? Gord On Sat, 28 Jan 2012 09:51:51 -0700, "Fawn Lagimodiere" wrote: I have a 50 files and I want it to run a macro to copy and paste to new sheet in the file on closing the document. Is there a code to run this process. thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I stop the close method in an auto close macro | Excel Programming | |||
Don't let user close. Use macro button to close? | Excel Programming | |||
Do I have to close an odc in a macro? | Excel Programming | |||
Run Macro on close | Excel Programming | |||
Macro Close 2 | Excel Programming |