VBA convert offset formula to range object

hobgoblinvasya

Board Regular
Joined
Jun 29, 2005
Messages
215
Hi all,

i am looking for a way to convert a cell's formula to a range object. Lets say i have a have that have a dynamic validation list though an offset formula. I need to loop an ensuing list to get all its values. Would anyone know, how would i achieve this through VBA.

ex: cell A1 has a similar formula to what's on this page:
http://www.contextures.com/xldataval02.html
http://www.contextures.com/DataValDynamic.zip (sample file)

I need to loop all the values in the dependent list when i choose one of the values on the master list.

So far i got to the part where i can extract the underlying formula that links dynamically to appropriate named range. something like (=OFFSET(INDIRECT(INDEX(RegionListLookup,MATCH(A2,RegionList,0))&"1"),0,0,COUNTA(INDIRECT(INDEX(RegionListLookup,MATCH(A2,RegionListe,0))&"1List")),1))

Now i need to extract the range that this will point to dependent on what is chosen in cell A2.

As usual thanks in advance !
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Having analyzed it some more i think it comes down to this:

I need to transform this formula into a range via VBA:
=OFFSET(Sheet1$T$110,0,0,3,1)

I tried using Evaluate("=OFFSET(Sheet1$T$110,0,0,3,1)"), but i get an error 2015. :(
If anyone know how to do it, it would be a huge help!
 
Upvote 0
OK, one final update. Apparently Evaluate does not like when the formula is in another language. When converted to English it seems to work ...

Thanks again everyone. Hope this will be helpful to someone else in the future :)
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,799
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top