I have a normal worksheet range MyRange from A1:B3, 3 rows, 2 columns
10 20
30 40
50 60
Code:
dim vvv as variant 'variant to permit cool range assignment
vvv=range("MyRange")
That probably looks unusual to you but check it out. You can assign a range to a variable, though AFAICT it can only be to a variant (or you'll be told you can't assign to an array).
So now I can go
?ubound(vvv,1), ubound(vvv,2), vvv(2,2)
3 2 40
So far nice. You can see vvv in the watch window and it looks like a 3 by 2 array.
Next step, create an "invisible" hard value named range
ThisWorkbook.Names.Add "rngHoldValues", vvv
This works. But I can't seem to practically access the new range. Well commented code with useful debug.prints is attached. Walking that code is the best way to see the problems. That's my question. How can I access "rngHoldValues" ? (Summary: range("rngHoldValues") is unrecognized in VBA!)
My objective is to
1. save off MyRange into memory (an interim step for 2., works okay)
2. create an "invisible" hard coded workbook range to hold the values (works okay)
3. Be able to retrieve the scratch range and put it in MyRange (ummm...)
FYI, all this is because other (unshown) code will overwrite MyRange, but I want to be able to recover the range contents. So if I crash, or end code, or heaven forbid, save the sheet with the overwritten values still in MyRange, then I'll have a routine to restore the values from the "invisible" created range.
Bookmarks