Using Sheet Name in combination with a named range [VBA/365/MAC]

LeighG

New Member
Joined
Feb 13, 2021
Messages
13
Office Version
  1. 365
Platform
  1. MacOS
Hi,

Office 365 / Mac OS

I have the following code which works perfectly. However I'd like to combine the Sheet Name (from the current workbook) in combination with the Named Range. I can't seem to get the syntax right.

VBA Code:
 Cells(1, 1).Value = ThisWorkbook.Names("Balance").RefersToRange(1, 1)

Thanks!
 
To scope a name to the sheet level on a Mac, one the DefineName dialog enter the name qualified by sheet reference in the Name box

e.g. Sheet2!MyName will create a name MyName that is only valid on Sheet2.
Great thanks, that's helpful.
And so if a sheet with a named range as per your example above is copied, does the new sheet have a range with the same name that is only scoped to that new sheet.
So in your example, If I copied Sheet2, and renamed it Sheet3, is there now a named range Sheet3!MyName scoped only to sheet 3.
(I think I've tested that this is the case, but validation would be nice)
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Have you looked at relative sheet referencing in names

If you define a name, scoped to the workbook, MyName, RefersTo =!$A$1
(note the !)

the formula =MyName will return the value from A1 of the sheet on which the formula is entered.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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