Applying Name Change to Existing Formulas

pulchramo574

New Member
Joined
May 10, 2017
Messages
10
Hi,

I've got a vast amount of names in my workbook (>100) for one time period, and have decided I want to expand my workbook to include data from multiple time periods. Hence I want to add a "_HY17" string to the end of every single one of my names, and have them updated in the existing formulas. Would anyone know of a quick way to do this using VBA?

Cheers.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
So I just did a test.

1. I named Cell A1 "test"
2. I typed 123 into Cell A1
3. Formula in Cell B1: =test, value displayed: 123
4. I created this macro and then ran it:

Code:
Sub testnames()
Dim nm As Name
For Each nm In ActiveWorkbook.Names
    nm.Name = nm.Name & "_456"
Next
End Sub

5. Cell A1 is now named "test_456"
6. The formula in Cell B1 is now: =test_456, value displayed: 123

All of that to illustrate that the simple macro I have above should do what you want it to do. You just need to change:

Code:
This:
nm.Name = nm.Name & "_456"

To:
nm.Name = nm.Name & "_HY17"
 
Upvote 0

Forum statistics

Threads
1,223,754
Messages
6,174,311
Members
452,554
Latest member
Louis1225

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