Macro: Edit link on behalf of Cell Information

lnkinho

New Member
Joined
Mar 16, 2015
Messages
18
Hi

Is it possible to edit link via Macro with information from a specific cell?

I want to change the excelfile name "110.xlsx" via a macro. So I thought I can put the filename in cell B1, lets say "109".

So when I click on the macro: either the macro can seach for 110 and replace all with B1, or change the name of the link. Not sure if either way is possible?

"=IFERROR('C:\Users\XX\Desktop\XX\cashflow\[110.xlsx]Contract Template'!$B2;0)"

Got any tips?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
This might be useful to you, the same ish issue there.

Or something like this


=Indirect("IFERROR('C:\Users\XX\Desktop\XX\cashflow\["& B1 &".xlsx]Contract Template'!$B2;0)")
 
Last edited:
Upvote 0
Link or formula?

If formula:
You have changed the "XX" to what it should be? And you have placed the workbook name in cell B1? the Workbook should be open, is it? (Last should not create ref error tho)
 
Upvote 0
Hm, think its the formula. Hm, Its open. But is it only possible when its open. I want it to be possible to not open the external workbook - isnt that possible?

Thats the link: =INDIRECT("IFERROR('C:\Users\mathis.edel\Desktop\FRAMO\cashflow\["& B1 &".xlsx]Contract Template'!$B2;0)")
 
Upvote 0
Indirect just fix the formula. Does it work without Indirect? but when you insert into the Indirect, and add the & B1 & . It wont work`?
 
Upvote 0
Hm, Im not sure. We can drop the Iferror for now, then the link is "='C:\Users\mathis.edel\Desktop\FRAMO\cashflow\[109.xlsx]Contract Template'!$B4" Could you put that link into the indirect formula?
 
Upvote 0
That should be like below, and have 109 in cell B1 of the same sheet as the formula.

=INDIRECT("='C:\Users\mathis.edel\Desktop\FRAMO\cashflow\[ " & B1 & ".xlsx]Contract Template'!$B4")
 
Upvote 0
Capture.jpg


Look here, doesnt work.. Cant understand what is wrong actually..
 
Upvote 0
I cant see anything i'm afraid. Test the indirect formula without the workbook filepath, and just the name, and see how it does.

Your workbook is open?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,646
Members
449,462
Latest member
Chislobog

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