vba - change link file path in excel -


i know if possible change file path of link in excel, using text in cell. trick here source workbook not open @ same time 1 has link in it, , not located in same folder.

ie: if once cell has link like:

='c:\thanks\forthehelp\01\[eg.xlsx]worksheet'!a1 

and want change file based on text input cell, ie: cell a1 has text: "02"

='c:\thanks\forthehelp\&a1&\[eg.xlsx]worksheet'!a1 

to

='c:\thanks\forthehelp\02\[eg.xlsx]worksheet'!a1 

i know above example doesn't work, think illustrates want here. appreciated. hope makes sense.

thanks.

you use indirect function implement constucted string destination workbook indirect not work on closed workbooks.

a vba routine replace formula in cell.

range("a1").formula = replace(range("a1").formula, "\01\", "\02\") 

if opt sort of formula replacement, should check ensure external workbook exists in new location akin dir function. using range.specialcells method xlcelltypeformulas property speed going through cells opposed looping through of cells , determining if range.hasformula property true.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -