VBA code to change sheet reference in formula

nina212001

New Member
Joined
May 19, 2015
Messages
8
I'm not the most proficient with VBA but have been doing a lot of googling to create one. What I've created is VBA code to insert and prompt a title for the new worksheet. I have formulas on a specific worksheet linked to various other worksheets and I need my new row (copy/inserted by the macro already) to change the sheet reference to the new worksheet. Each time the worksheet name will vary because the macro is taking the last row of data and copying/inserting new row after. Formula reference below:
=IF((VLOOKUP(C$3,'Club 6.24.20'!$A:$B,2,FALSE))="","",(VLOOKUP(C$3,'Club 6.24.20'!$A:$B,2,FALSE)))

How do I set the VBA to recognize the old worksheet name and insert the new worksheet name?
 
I included a screenshot so hopefully to help. If I run the previous code, it will take row 12 and insert a copied row below. Meaning row 13 will become the last row for the step to replace sheet reference in formulas. I am using colums A to AO but might have a need to insert additional columns, which was why I hoped to user the entire row as the range. There will not be data below.
Untitled.png
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,214,585
Messages
6,120,390
Members
448,957
Latest member
Hat4Life

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