Macro to update link within Current workbook

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have the following code to update links within the current workbook

Code:
 Sub Update_Links
ActiveWorkbook.UpdateLink Type:=xlExcelLinks
End Sub


when activating the code the folder is opened , I then need to select the workbook C:\my documents Sales report Ver 1.4.xlsm and then select sheets 'Data" to update the workbook


I would like to incorporate this workbook and sheet into my code so I do not have to select this manually


your assistance in this regard is most appreciated[/code]
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Thanks for the help, but when opening the workwook, i first select do not update and the copy the data and paste as valuesinto the previous month. I then save the file & re-open and then select update and the currect data is updated based on several links

I would like a macro to update all the links instead of the manual process
 
Upvote 0
Understood.

By the way, you shouldn't need to close & reopen the file to update the links. If you go to the Data tab in the menu, you will see a button to refresh all links.

To do it in a macro, add the following line to your macro:
VBA Code:
    ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources, Type:=xlExcelLinks
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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