@ cyiangou,
. Hi ,
. Thank you very much for your contribution. I am extremely grateful: It appears to be exactly what I had been searching for for some considerable time now. I had been getting the impression that it was not possible
. I was immediately able to get the results I was looking for, and was about to reply to say thanks,. But I got ( and am still slightly ) bogged down for several hours in trying to understand exactly how it is working.. and in an attempt to make the Function more general for me..
. I was however able to get exactly what I wanted, that is to say my original request has been well answerd...
.
. Just to clarify that.
. I take any spreadsheet range, say for example this
Using Excel 2007
Row\Col |
B |
C |
D |
E |
4 |
4 |
407D |
|
|
5 |
5 |
408Q |
|
|
6 |
6 |
405P |
|
|
7 |
7 |
403A |
|
|
. I run this modified version of the code from you given in Post #2 , ( that is to say i run code
Sub Test_cyiangouFunction1()
.
. Stepping throught the code in F8 one gets exactly as wanted: on the first run the an Array
CatchArray()
. is created.
. On subsequent runs the function finds the array is already populated and just accesses it
.
Brilliant!!!
Thanks cyiangou,
P.s.
.
. Just for fun, after the first run of the
Sub Test_cyiangouFunction1()
. one can run this
.. and one achieves this
Using Excel 2007
Row\Col |
B |
C |
D |
E |
4 |
4 |
407D |
4 |
407D |
5 |
5 |
408Q |
5 |
408Q |
6 |
6 |
405P |
6 |
405P |
7 |
7 |
403A |
7 |
403A |
.. again demonstrating ... “ Store Array and values in variables created by VBA macro “Internally” for use in same VBA macro by next run, or by other VBA macros, after the macro creating the Array or Variables has stopped. „…
Many Thanks again for all the help
Alan
……
P.P.s . Just in case anyone can help with the couple of things still niggling me…
. 1 ) I do not understand why this does not work as an alternative form of the function
. is this maybe telling me that my Privates !
must be an object, variant or the such and cannot be an Array?
.........
. 2) Just for fun, I thught I would generalise the function for so as to work for a single cell also ( The original Fuction falls down there as a value is returned rather than an Array. )
.. I spent a couple of hours with code variations of the example below.. But they always fall down at the point of lines such as 110 below.. I can’t seem to force
GetCachedValue2sAlsoFor1Cell
Into becoming an Array of one element
.. I will leave this Thread as unanswered for a few days in case anyone else has some input. Otherwise i will mark it as solved as the original request has been nicely satisfied
Bookmarks