VBA code to Modify Formula using new External Workbook Hyperlink

jgiltner

New Member
Joined
Sep 16, 2019
Messages
1
Hi,

I have a Workbook that serves as an aggregation of data from several other external workbooks (same file directory). The workbooks being referenced are all uniform, so the specific sheet and cell reference is always the same in a column with the only thing changing being the workbook name. Reference formulas are already built-out for 5 workbooks and will pull in the data appropriately when a workbook is added to the same folder and re-named using the generic serial identifier referenced in the formula ex. ='C:\...\Desktop\[WB 0001.xlsx.]Sheet1'$A$1. What I would like to do is use VBA code to pull-down the formulas and modify them to reference a new workbook when added. I am open to suggestions on how to efficiently do this. In my head, it seems like there should be a way to establish the hyperlink to the file once and then use VBA to copy the formulas using the new link as an input. I appreciate any help on the matter. Simplified example below.

Disclaimer: I have very limited VBA experience.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Hyperlink Reference[/TD]
[TD]Data Reference[/TD]
[/TR]
[TR]
[TD]WB 001.xlsx[/TD]
[TD]='C:\...\Desktop\[WB 001.xlsx]Sheet1'!$A$1[/TD]
[/TR]
[TR]
[TD]WB 002.xlsx[/TD]
[TD]^ want to copy this down and change [WB 001.xlsx] to [WB 002.xlsx][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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