View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Brian Murphy Brian Murphy is offline
external usenet poster
 
Posts: 126
Default strange VBA behavior with named ranges

I did not know about the sort order of defined names. So I definitely
have learned something new.

When you explain it as a "visibility" issue in relation to the sort
order, it all now makes sense.

I came across this in a VBA routine which uses Application.Evaluate to
compute some values using named ranges. The easy fix was to put the
sheet name in front of the defined name. For example:

x = Application.Evaluate("MAX(somenamedrange)")

now says

x = Application.Evaluate("MAX('sheet name'!somenamedrange)")

This gives me the result I want even if a chart sheet is the active
sheet.

Cheers,

Brian