Reassigning a named cell reference

m_in_spain

Board Regular
Joined
Sep 28, 2018
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have a named cell on sheet Commercial! at F17 called "Warranty". When i finish and run my project that figure is used in various claculations, the updated workbook is saved as a macro free xlsx file.
My enduser may need to change the "warranty" Figure, however my original sheet containing that will be very hidden.
Is there a way using VBA to change the refers to for the name "Warranty" from =Commercial!$F$17 to =TCJ!$G$47
I can't for the life of me think how to phrase this to search in here or indeed even in Google for this answer
Any help, as ever, will be much appreciated
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try something like this
VBA Code:
    Dim oWs As Worksheet
    Set oWs = ThisWorkbook    ' << or whatever workbook the named range is in
    oWs.Names("Warranty").RefersTo = "=TCJ!$G$47"
 
Upvote 0
Don't know what was wrong with me, but the above code makes less sense. With a little luck you would have discovered it yourself, it should have been like this:
VBA Code:
    Dim oWb As Workbook
    Set oWb = ThisWorkbook    ' << or whatever workbook the named range is in
    oWb.Names("Warranty").RefersTo = "=TCJ!$G$47"
 
Upvote 0
Don't know what was wrong with me, but the above code makes less sense. With a little luck you would have discovered it yourself, it should have been like this:
VBA Code:
    Dim oWb As Workbook
    Set oWb = ThisWorkbook    ' << or whatever workbook the named range is in
    oWb.Names("Warranty").RefersTo = "=TCJ!$G$47"
Hi, thanks for that, i did try your first suggestion, but it didnt work, I discovered that i can just get excel to cut and paste the cells i need, before it closes!, but i will now try your later suggestion as it is much neater.
Thanks again
 
Upvote 0

Forum statistics

Threads
1,213,495
Messages
6,113,992
Members
448,538
Latest member
alex78

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