Convert to contents

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,074
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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,223,948
Messages
6,175,568
Members
452,652
Latest member
eduedu

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