[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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?
0
BW999
Asked:
BW999
  • 3
  • 3
1 Solution
 
NorieCommented:
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.
0
 
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.....
0
 
NorieCommented:
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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.  

0
 
NorieCommented:
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.
0
 
BW999Author Commented:
Thanks again.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now