You are here:

Excel/Run macro consecutively


Dear Damon,

I have a reporting tools work within excel (extract data from Oracle), to run this reporting tool, I login in (Add-Ins) which is have an icon related to this software.
My requirements: I need to run macro say (calculate Sheet 1, after finish, calculate Sheet 2, after finish, calculate Sheet 3....etc).
Reason: If I allow excel to calculate all sheets together, system will hang.

Note: calculate here means press (Alt + Ctrl + S) which is calculate sheet shortcut in our reporting tools.

Kindly advise.


Hi Mahmoud,

In VBA you can use the worksheet object's Calculate method to force a worksheet to calculate.  You can put this in a loop to calculate the sheets in sequence like this:

Sub SequentialCalc()
  'Calculates worksheets 1-3 on at a time in sequence
  Dim i    As Integer
  For i = 1 To 3
  Next i
End Sub

I did not use the worksheet names, but rather the worksheet indices because I assumed that Sheet1, Sheet2, and Sheet3 are the first 3 worksheet tabs in your workbook.  But to do it by sheet names you could use concatenation like this:

Sub SequentialCalc()
  'Calculates worksheets 1-3 one at a time in sequence
  Dim i    As Integer
  For i = 1 To 3
     Worksheets("Sheet" & i).Calculate
  Next i
End Sub

Here I'm assuming that the sheet names don't actually have a space between "Sheet" and the number.

I hope you find this helpful.

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Damon Ostrander


I have extensive experience with VBA programming in Excel 5 through Excel 2013. As a former aerospace engineer with a large aerospace corporation and consultant in a small defense technology services company, I have developed a wide range of applications in VBA, including simulations involving mixed-language programming, satellite orbit mechanics, graphics and animation, and real-time applications. I am interested in moderate to hard VBA-related questions only.


I have developed and taught several courses in Excel VBA programming and also VBA programming in Office 97, 2000, and 2007. I have developed a number of large technical applications in Excel VBA for use within the aerospace industry.

B.S. in Electrical Engineering and Computer Science, University of California, Berkeley.

©2017 All rights reserved.