How to run the Excel Macros in parallel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • modularmix
    New Member
    • Jun 2007
    • 2

    #1

    How to run the Excel Macros in parallel

    Does anyone know the code for running the Excel Macro for two different spreadsheets in parallel. Here is the code that works for them sequentially.
    Code:
    Workbooks.Open Filename:="C:\Documents and Settings\Administrator.SLB_EUROPE\Desktop\norm ops 150607.xls"
    
    ' Select Asset & Portfolio Parameter sheet
    Sheets("Asset & Portfolio Parameter").Select
    
    ' Change the number of iterations
    Range("D7").Select
    ActiveCell.FormulaR1C1 = "50"
    
    ' Start to run the macro
    Range("D8").Select
    Application.Run "'norm ops 150607.xls'!Macro2"
    
    ' Save and close the spreadsheet
    ActiveWorkbook.Save
    ActiveWindow.Close
    
    
    
    
    Workbooks.Open Filename:="C:\Documents and Settings\Administrator.SLB_EUROPE\Desktop\sachsend isruption6mths.xls"
    
    ' Select Asset & Portfolio Parameter sheet
    Sheets("Asset & Portfolio Parameter").Select
    
    ' Change the number of iterations
    Range("D7").Select
    ActiveCell.FormulaR1C1 = "50"
    
    ' Start to run the macro
    Range("D8").Select
    Application.Run "'sachsendisruption6mths.xls'!Macro2"
    
    ' Save and close the spreadsheet
    ActiveWorkbook.Save
    ActiveWindow.Close
    For example, I would like to write the code which allows these macros to run in parallel so that it would take only one fourth of the time to run macros that it would take if running sequentially for four different spreadsheets.

    Thanks.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Greetings, modularmix!

    I fetched Google on this one only becasue I was not sure what exactly you are trying to do. Please give link a whirl see what you have. Merely plugged in your title and fired away:



    Write if more help is needed...

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Let us know what you find out, too. I don't think it's possible to multi-stream your macros, but it will probably turn out that I'm wrong.

      Perhaps if one were fired by OnTime() or something...

      Comment

      Working...