Hi, I am fairly inexperienced in VBA and I'm having trouble with getting to the values in a named range in a subroutine.
I have many named ranges in my project, some of which are defined as simple ranges ($A$1:$A$10 for example), and some of which are dynamically defined using OFFSET (for tables which change in length etc.)
For a named range defined as a simple range, I can do the following:
Or something like that, anyway, I'm picking bits out of my code to show you. Now, my problem is that if I try to do this with a named range that has been defined using OFFSET, this method doesn't work. I have tried several different ways and I always get some error Can anyone show me how to use such named ranges within VBA?
I am assuming that it's because .RefersToRange requires the Named Range to point to a range directly, but the ones with OFFSET point to a formula... I have tried removing the .RefersToRange completely, and tried it with .RefersTo and neither worked. Is there a way I can, instead of using the OFFSET named range, simply create a reference to the same range using the OFFSET formula within VBA? If so, how do I then get the values out within the For/Next loop?
Thanks for any help, I can provide more info/code if required.
Bookmarks