Get Range Reference By Way Of Evaluate Function

L

Legacy 98055

Guest
I have to determine several references based upon a link address that my code will not know ahead of time.

For example:

"Sheet1!J:J"
This is Sheet1 of ThisWorkbook, column J

"[Book1.xls]Sheet2!A:A"
This is Sheet2 of Book1.xls, column A

Set SomeWorkbook = Evaluate("=INDIRECT(""Sheet1!A:A"")").Parent.Parent

I was hoping that this would evaluate to a range, the parent worksheet of the range, and the parent workbook of the worksheet.

By the way, I am not lifting this out of some formula that has been entered into a cell. This string is in a cell formatted as text.

I know I could parse the string and determine if the reference is remote or even use the LinkSources method, but I was hoping to use the simpler syntax if possible.

Thanks for any help! :)
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Answered!

Set ParentWorkbook = Evaluate("[Book1.xls]Sheet1!J:J").Parent.Parent

Thanks so much for the help!

Your welcome!

:)
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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