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
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: