Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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
.

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 turn on universal scrolling? C Fowler Excel Discussion (Misc queries) 1 January 21st 09 04:01 PM
Universal formulas for any given row lamontd7 New Users to Excel 3 August 1st 05 02:55 PM
Use combobox for universal purpose Pat Excel Programming 20 May 8th 04 09:01 PM
Need new idea for universal path Dan Merchant Excel Programming 0 August 1st 03 01:50 PM
Need new idea for universal path Steve Smallman Excel Programming 0 August 1st 03 09:19 AM


All times are GMT +1. The time now is 05:53 AM.

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"