Using [brackets] to refer to range names

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?
Who is Participating?
NorieVBA ExpertCommented:
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.
NorieVBA ExpertCommented:
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.
BW999Author Commented:
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.....
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

NorieVBA ExpertCommented:
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.
BW999Author Commented:

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.  

BW999Author Commented:
Thanks again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.