hELP ME SO i CAN run THIS codeS to all worksheets in the activeworkbook AT ONE TIME,(e.i. Oct 2008). I record this macro IN my Personal macros as 'Macro5.'
Code:Windows("IDF Clearing Template REVISED.xls").Activate Rows("1:2").Select Range("BE1").Activate Selection.Copy Windows("Oct 2008.xls").Activate Rows("1:1").Select Range("BG1").Activate Selection.Insert Shift:=xlDown Windows("IDF Clearing Template REVISED.xls").Activate Columns("BM:BQ").Select Application.CutCopyMode = False Selection.Copy Windows("Oct 2008.xls").Activate Application.WindowState = xlMinimized Columns("BM:BM").Select ActiveSheet.Paste Range("BN2").Select Application.Run "'IDF Clearing Template REVISED.xls'!Macro1"
Thanks and best regards
Last edited by royUK; 12-08-2008 at 11:41 AM.
Is this what you want?
Code:Dim sh As Worksheet Dim target As Worksheet Set target = Workbooks("Oct 2008.xls").Worksheets(1) For Each sh In Workbooks("IDF Clearing Template REVISED.xls") sh.Range("BE1").Copy target.Range("BG1").Insert Shift:=xlDown sh.Columns("BM:BQ").Copy target.Columns("BM:BM") SHRange("BN2").Select Application.Run "'IDF Clearing Template REVISED.xls'!Macro1" Next sh
Your post does not comply with Rule 3 of our Forum Rules. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here http://www.excelforum.com/misc.php?do=bbcode#code
Note: I will add them this time only!
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
HI.
my working file is the 'Oct 2008.xls'. In each Worksheet, I want to run the the 'macro5' located in my "Personal Macros.bas".
Thanks
Is this whay ytou mean, place the code in the workbook you are using
Code:Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets Application.Run "'Personal.xls'!Macro5" Next ws
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
Then you either need to amend macro5 to work efficiently to suit your needs or amend my code to actually select each sheet, which will of course be slower & less efficientr
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks