Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default run macro on all closed workbooks in folder and subfolders

I would like to be able to run the following macro on a large group of
workbooks without having to open them individually. Any help would be
appreciated. Thanks.

spence

Sub COLAcontracts()
'
' COLAcontracts Macro
' Macro recorded 5/1/2007 by inclusion
'

'
Sheets("IFIS").Select
ActiveSheet.Unprotect Password:="santaclaus"
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("B1:B5").Select
Selection.Copy
Range("K5").Select
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("C1:K5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
Application.CutCopyMode = False
ActiveSheet.Protect Password:="santaclaus", DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default run macro on all closed workbooks in folder and subfolders

Hi spence

You must open them

You can look at this example that copy a range to each workbook
http://www.rondebruin.nl/copy4.htm
You can replace the copy code with your code


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spence" wrote in message ...
I would like to be able to run the following macro on a large group of
workbooks without having to open them individually. Any help would be
appreciated. Thanks.

spence

Sub COLAcontracts()
'
' COLAcontracts Macro
' Macro recorded 5/1/2007 by inclusion
'

'
Sheets("IFIS").Select
ActiveSheet.Unprotect Password:="santaclaus"
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("B1:B5").Select
Selection.Copy
Range("K5").Select
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("C1:K5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
Application.CutCopyMode = False
ActiveSheet.Protect Password:="santaclaus", DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWindow.Close
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default run macro on all closed workbooks in folder and subfolders

Ron,

Thanks. I can live with that. Your website is very informative by the way. I
have a third party add-on that compiles ranges from closed workbooks but it's
nice to see how to build some of this stuff myself. Your site is a resource I
think I'll find myself going back to many times. I appreciate it.

spence

"Ron de Bruin" wrote:

Hi spence

You must open them

You can look at this example that copy a range to each workbook
http://www.rondebruin.nl/copy4.htm
You can replace the copy code with your code


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spence" wrote in message ...
I would like to be able to run the following macro on a large group of
workbooks without having to open them individually. Any help would be
appreciated. Thanks.

spence

Sub COLAcontracts()
'
' COLAcontracts Macro
' Macro recorded 5/1/2007 by inclusion
'

'
Sheets("IFIS").Select
ActiveSheet.Unprotect Password:="santaclaus"
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("B1:B5").Select
Selection.Copy
Range("K5").Select
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("C1:K5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
Application.CutCopyMode = False
ActiveSheet.Protect Password:="santaclaus", DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWindow.Close
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default run macro on all closed workbooks in folder and subfolders

Hi spence

I changing all pages on this moment on my site and update the code so that it is also working in 2007.

have a third party add-on that compiles ranges from closed workbooks

I have upload a new add-in to merge
http://www.rondebruin.nl/merge.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spence" wrote in message ...
Ron,

Thanks. I can live with that. Your website is very informative by the way. I
have a third party add-on that compiles ranges from closed workbooks but it's
nice to see how to build some of this stuff myself. Your site is a resource I
think I'll find myself going back to many times. I appreciate it.

spence

"Ron de Bruin" wrote:

Hi spence

You must open them

You can look at this example that copy a range to each workbook
http://www.rondebruin.nl/copy4.htm
You can replace the copy code with your code


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spence" wrote in message ...
I would like to be able to run the following macro on a large group of
workbooks without having to open them individually. Any help would be
appreciated. Thanks.

spence

Sub COLAcontracts()
'
' COLAcontracts Macro
' Macro recorded 5/1/2007 by inclusion
'

'
Sheets("IFIS").Select
ActiveSheet.Unprotect Password:="santaclaus"
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Range("B1:B5").Select
Selection.Copy
Range("K5").Select
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("C1:K5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
Application.CutCopyMode = False
ActiveSheet.Protect Password:="santaclaus", DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWindow.Close
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
How to List the names of the subfolders present in the folder (path of folder is given in the textbox by user ) divya Excel Programming 3 November 30th 06 11:34 AM
Possible ? Search all closed workbooks in a folder Corey Excel Programming 1 July 8th 06 04:31 PM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
Perform code on all (closed) workbooks scattered across sub-folders of common parent folder ikr[_2_] Excel Programming 6 February 21st 06 08:08 AM
please help me with folder and subfolders pieros Excel Programming 2 November 4th 05 12:52 PM


All times are GMT +1. The time now is 07:46 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"