How to enter a link path in one of the cells in a worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
I created a workbook that use data from another workbook (Data Workbook). The Data Workbook name is changing from time to time. I'm using the Edit/Link/Change Source to update the new link

1. Is there a way to automate the change link procedure ?
2. Is there a way to have the updated link be sored in one of the the spreadsheet cells (as a formula or a link) that will reflect the actual link ?

Thanks, Nehemia
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You could place some code like below in the Private module of the Workbook Object. Right click on the Excel icon, top left next to file and select "View Code" Then paste in this:


Private Sub Workbook_Open()
Dim strOldName As String
Dim strNewName As String
strOldName = WorksheetFunction.Substitute(Me.Name, ".xls", "")
strNewName = Sheet1.Cells(1, 1)

ThisWorkbook.ChangeLink Name:=strOldName, NewName:=strNewName, _
Type:=xlExcelLinks
End Sub


It looks in cell A1 of sheet1 for a FULL path, eg

"C:OzGridalpha1.xls"
 
Upvote 0

Forum statistics

Threads
1,223,400
Messages
6,171,891
Members
452,431
Latest member
TiffanyMcllwain

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