![]() |
Universal Macro
Hello
I have created quite a simple macro in Excel that formats a spreadsheet the way that i want it to e.g. deleting/inserting columns/rows, shading, placing borders etc and i also have the code for this macro. I was wondering if there is any way to apply this macro to numerous spreadsheets without having to open each one seperately and insert the code, so in effect possibly clicking a button and say 12 spreadsheets run the same macro simultaneously. Your help would be greatly appreciated Thanks Sam |
Universal Macro
Sam
You can put this macro in your Personal.xls or in any file (spreadsheet) that's open. Then put all the files that you want to operate on in one folder. Then modify the macro for the path to that folder. HTH Otto Sub AllFolderFiles() Dim wb As Workbook Dim TheFile As String Dim MyPath As String MyPath = "C:\Temp" ChDir MyPath TheFile = Dir("*.xls") Do While TheFile < "" Set wb = Workbooks.Open(MyPath & "\" & TheFile) MsgBox wb.FullName wb.Close TheFile = Dir Loop End Sub "Sam Thurston" wrote in message ... Hello I have created quite a simple macro in Excel that formats a spreadsheet the way that i want it to e.g. deleting/inserting columns/rows, shading, placing borders etc and i also have the code for this macro. I was wondering if there is any way to apply this macro to numerous spreadsheets without having to open each one seperately and insert the code, so in effect possibly clicking a button and say 12 spreadsheets run the same macro simultaneously. Your help would be greatly appreciated Thanks Sam |
Universal Macro
Sam
Open the book with the macro, then open a new workbook. Press Alt + F8, select the macro and run. Regards peter -----Original Message----- Hello I have created quite a simple macro in Excel that formats a spreadsheet the way that i want it to e.g. deleting/inserting columns/rows, shading, placing borders etc and i also have the code for this macro. I was wondering if there is any way to apply this macro to numerous spreadsheets without having to open each one seperately and insert the code, so in effect possibly clicking a button and say 12 spreadsheets run the same macro simultaneously. Your help would be greatly appreciated Thanks Sam . |
All times are GMT +1. The time now is 02:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com