Enabling Circular References by Default

Written by Allen Wyatt (last updated March 23, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Ron has a workbook that requires the use of circular references, which he can configure Excel for just fine. After protecting and e-mailing the workbook to colleagues, upon their use, the iterative capability (required for circular references) is turned off and the worksheet fails due to circular-reference errors. Ron wonders if there is a way to default the workbook so that circular references are enabled when it is loaded by his colleagues.

The only way to make sure that the colleagues' workbooks have circular references enabled is to add a macro to your workbook. The macro is actually only one line long, and you'll want to make sure you add it to the ThisWorkbook module:

Private Sub Workbook_Open()
    Application.Iteration = True
End Sub

The macro runs every time the workbook is opened, and it turns on the circular references setting.

There are a couple of things to remember when it comes to having this actually work for your colleagues. First, your workbook will need to be saved in a "macro enabled" version, meaning it will have the extension XLSM. If your colleagues disable macros—either explicitly when opening the workbook or implicitly through the Security Center settings they have set up in Excel—then the macro may not run when the workbook is opened. In such situations, these colleagues will still get the circular-reference errors.

The second thing to remember is that enabling the circular-reference setting (either through this macro or by doing so manually) will affect not just calculations on your workbook, but on any workbook your colleagues may have open. This shouldn't cause a huge problem, but it is still a good thing to keep in mind.

You may also want to add a macro to turn off the circular-reference setting when your workbook is closed. This, too, should be added to the ThisWorkbook module:

Private Sub Workbook_Close()
    Application.Iteration = False
End Sub

This macro should actually be considered optional, and you may want to consider if you really want to include it or not. If your colleagues normally work with the circular-reference setting enabled, then the Workbook_Open macro won't really mess with how they use Excel. However, if your Workbook_Close macro is encountered, it will turn off the circular-reference setting and may interfere with how they use any other workbooks that require circular references.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13532) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Using the COLUMN Function

Need to know the column number for use in a formula? The worksheet function you want is the COLUMN function, described in ...

Discover More

Displaying the First Worksheet in a Macro

When creating macros, you often have to know how to display individual worksheets. VBA provides several ways you can ...

Discover More

Unhiding a Limited Number of Columns

If you have a bunch of hidden columns in your worksheet, you might want to unhide only a portion of those columns. This ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Disappearing Ribbon Buttons

Excel allows you to configure your system, even to the point of adding macros to your ribbon area. What are you to do, ...

Discover More

Changing Excel's Starting Date

When keeping track of dates, internally, Excel uses special date serial numbers that are based upon a specific day in the ...

Discover More

Transferring Ribbon Customizations

Excel allows you to make a wide range of customizations to both the Quick Access Toolbar and the ribbon. If you want to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two less than 9?

2024-03-23 11:30:43

J. Woolley

There is no Workbook_Close event procedure. The Tip's references to Workbook_Close should be replaced by Workbook_BeforeClose and
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Here is a better pair of event procedures for your ThisWorkbook module. The original values are restored before the workbook is closed.

Private Iteration As Boolean, MaxChange As Double, MaxIterations As Long

Private Sub Workbook_Open()
    With Application
        Iteration = .Iteration
        MaxChange = .MaxChange
        MaxIterations = .MaxIterations
        .Iteration = True
        .MaxChange = 0.001 'adjust as required
        .MaxIterations = 100 'adjust as required
    End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    With Application
        .Iteration = Iteration
        .MaxChange = MaxChange
        .MaxIterations = MaxIterations
    End With
End Sub


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.