Automatically creating links in one workbook to several workbooks

Iceman3395

New Member
Joined
Jun 2, 2017
Messages
12
Below is the modules I'm trying to get to work. I have added comments in blue where module has troubles. I cannot resolve the issue with having to open the file and also the issues with looping thru the next files.

Your help would be greatly appreciated


Sub Linkworkbooks()

'Linking O&M Errors Workbook to Detailed O&M Budget Workbooks. There are 45 different files to add links to this one file

'List of real file to test with Files
'O&M 1989.1990.xlsx
'O&M 1990.1991.xlsm
'Sayisi Dene O&M 1991.1992 .xlsm
'Sayisi Dene O&M 1992.1993 .xlsm
'Sayisi Dene O&M 1994.1995 .xlsm
'Sayisi Dene O&M 1995.1996 .xlsm
'Sayisi Dene O&M 1996.1997 .xlsm
'Sayisi Dene O&M 1997.1998 .xlsm
'Sayisi Dene O&M 1998.1999 .xlsm
'Sayisi Dene O&M 1999.2000.xlsm
'Sayisi Dene O&M 2000.2001 .xlsm
'Sayisi Dene O&M 2001.2002 .xlsm
'Sayisi Dene O&M 2002.2003 .xlsm
'Sayisi Dene O&M 2003.2004 .xlsm
'Sayisi Dene O&M 2004.2005 .xlsm
'Sayisi Dene O&M 2005.2006 .xlsm
'Sayisi Dene O&M 2006.2007 .xlsm
'Sayisi Dene O&M 2009.2010 .xlsm



' Start in Cell B37

Range("B37").Select
Range("B37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsx]Sheet1 (2)'!R1C5"

'Module stops here and asks to open file once file is open rest of Module completes

Range("D37").Select
Range("D37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsx]Sheet1 (2)'!R27C12"

Range("E37").Select
Range("E37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsx]Sheet1 (2)'!R89C12"

Range("F37").Select
Range("F37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsx]Sheet1 (2)'!R104C12"

Range("I37").Select
Range("I37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsx]Sheet1 (2)'!R15C8"

Range("K37").Select
Range("K37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsxx]Sheet1 (2)'!R1C6"

Range("L37").Select
Range("L37").FormulaR1C1 = "=+'[O&M 1989.1990.xlsx]Sheet1 (2)'!R156C12"

Range("B36").Select

'Want to start a with the next file on list and loop through the above noted process until all files have been linked.
'I know I can do this manually but I have at least 45 more files to add to the list.


End Sub
 
Last edited:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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