Convert to contents

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,110
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
If I have a string e.g. "Sheet1!$B$2", is there a Excel function that will give me
the contents of that cell? Or must it be a UDF, in which case , no problem.
 
You don't need Evaluate or Indirect in code, you can just use Range:

Code:
application.range("Sheet1!B2")
Well, what do you know, that does work! :eek:

It never occurred to me to see if the Range object would tolerate that reference format as its argument.:banghead:

By the way, you can omit the Application keyword as using Range by itself also seems to work.
 
Last edited:
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
By the way, you can omit the Application keyword as using Range by itself also seems to work.

It won't if the code is in a different worksheet. Although that won't be the case here, I prefer to always specify it.
 
Upvote 0
Thanks Rory, That works very nicely , and was a big help.
And Eric, I will try your suggestion. Yes the string was typed in. It's just ranges aren't instinctive and strings are.
 
Upvote 0

Forum statistics

Threads
1,224,938
Messages
6,181,870
Members
453,068
Latest member
DCD1872

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