I've looked through the OzGrid VBMacros Help File, which I think is excellent, but can not find the solution to my particular
problem. I may be trying to solve the incorrect problem so I'll state my direct question and then why I'm trying to do
Question 1: The example code below is supposed to let you define a named range from within VBA. When I run
the example code and then look in the WorkSheet, the named range is not defined. If it is possible to do this, please
provide a simple function that will illustrate it.
Range("C4:R9").Name = "SomeName"
Set tempRange = Range("C4:R9")
tempRange.Name = "SomeName"
If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Question 1A. Can the pure numeric way of referencing cell ranges be used in the above functions? If so, what is the
proper syntax e.g "C4:R9" --> something like (3,4:18,9) which doesn't compile
Question 2: (the reason for
Question 1) Is there a way to make named ranges defined by a function available to other functions? This is what I am
attempting to do in Question 1. It seems logical to me that since I can read and reference named ranges created in the
worksheet and that I can "create" them in VBA, that it should be able for the named range to "travel back" to the worksheet.
I plan on defining the named ranges based on results generated from earlier steps so that I can reference them when I need
them in other functions. I've had no problem referencing the named ranges define while in the Worksheet but now I want to
figure out my range based on the data that is generated at run time and then let other code reference those names.
Perhaps there is some more appropriate way to make the names "globally" available and persistant at least until the file is