Using [brackets] to refer to range names

Posted on 2011-10-16
Last Modified: 2013-11-05
Have excel workbook with macros that run fine in excel 2003.
when I try it with Excel 2010, it freezes when it encounters any code that uses [brackets] to refer to a named range.   Forces me to use "Range("alpha")"  instead of just [alpha].

There must be a setting somewhere to fix this.  Do I have to revise the code?
Question by:BW999
    LVL 33

    Expert Comment

    I don't think there is a setting or fix for this.

    The []s evaluate the expression within them, you can even use it for arithmetic eg  [5*5].

    With a named range that has more than one cell [namedrange] will evaluate to an array.

    I don't know how or where you are using [] in your code, but perhaps an array isn't appropriate.

    Author Comment

    Thanks.  I didnt realize that [] had broader use.    The problem is specific for Excel 2010 64x.  The [] code works fine with Excel 2003.  Wait an see if anyone else has suggestions.....
    LVL 33

    Expert Comment

    Why not just use Range?

    Then it should work in both versions.

    Using [] isn't usually used in code but obviously has it's uses.

    There could actually be another problem with the scope of the named ranges but that would depend on how you were using them in the code and/or how they were defined.

    Author Comment


    I have lots of code that uses [].  Can convert using search/replace.  I generally like to keep code compact and [] takes less space and easier to read.  But if Range fixes it, I will go with that. But I am curious why the problem shows up in Excel 64-bit but not in Excel 32-bit.  

    LVL 33

    Accepted Solution

    It's not something I've heard of.

    Most 64-bit problems seem to relate to API, and incompatibility with other applications.

    The former is probably one of the reasons not a lot of people use it.

    I know using [] is compact but it might be confusing for some people.

    Also most of the time when I've seen it used it's been for evaluation purposes rather than referring to a range.

    Author Closing Comment

    Thanks again.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
    Introduction This Article is a follow-up to my Mappit! Addin Article (, it was inspired by an email posting I made to EUSPRIG (, I will briefly cover: 1) An overvie…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now