sub Compile_all()
Dim path, MM, SS, FF, arg1, arg2, arg3, arg4, arg5 arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17 as String
' File location
Path = "S:\Power Networks\Asset Management\SND\OPC\WAYLEAVES\Balance Score Card\"
'
' Subfolders
for b = 1 to 4
if b = 1 then MM = "Chris Lawrence" & "\"
if b = 2 then MM = "Dave Spinner" & "\"
if b = 3 then MM = "Peter Wyatt" & "\"
if b = 4 then MM = "Derek Timms" & "\"
'
'
' File name
if b = 1 then FF = "BSC 2010 - Chris Lawrence"
if b = 2 then FF = "BSC 2010 - Dave Spinner"
if b = 3 then FF = "BSC 2010 - Peter Wyatt"
if b = 4 then FF = "BSC 2010 - Derek Timms"
'
'
' Sheets
For a = 1 to 12 ' 12 months I hope is being pulled
SS = sheets(a).name
SS = SS & "'!"
'
'
CC1 = Cells(6,7).Address(, , xlR1C1)
CC2 = Cells(7,7).Address(, , xlR1C1)
CC3 = Cells(10,7).Address(, , xlR1C1)
CC4 = Cells(11,7).Address(, , xlR1C1)
CC5 = Cells(12,7).Address(, , xlR1C1)
CC6 = Cells(14,7).Address(, , xlR1C1)
CC7 = Cells(15,7).Address(, , xlR1C1)
CC8 = Cells(16,7).Address(, , xlR1C1)
CC9 = Cells(17,7).Address(, , xlR1C1)
CC10 = Cells(18,7).Address(, , xlR1C1)
CC11 = Cells(20,7).Address(, , xlR1C1)
CC12 = Cells(21,7).Address(, , xlR1C1)
CC13 = Cells(23,7).Address(, , xlR1C1)
CC14 = Cells(24,7).Address(, , xlR1C1)
CC15 = Cells(25,7).Address(, , xlR1C1)
CC16 = Cells(26,7).Address(, , xlR1C1)
CC17 = Cells(27,7).Address(, , xlR1C1)
'
'
' Construct Arguments
arg1 = "'" & Path & MM & "[" & FF & "]" & SS & CC1
arg2 = "'" & Path & MM & "[" & FF & "]" & SS & CC2
arg3 = "'" & Path & MM & "[" & FF & "]" & SS & CC3
arg4 = "'" & Path & MM & "[" & FF & "]" & SS & CC4
arg5 = "'" & Path & MM & "[" & FF & "]" & SS & CC5
arg6 = "'" & Path & MM & "[" & FF & "]" & SS & CC6
arg7 = "'" & Path & MM & "[" & FF & "]" & SS & CC7
arg8 = "'" & Path & MM & "[" & FF & "]" & SS & CC8
arg9 = "'" & Path & MM & "[" & FF & "]" & SS & CC9
arg10 = "'" & Path & MM & "[" & FF & "]" & SS & CC10
arg11 = "'" & Path & MM & "[" & FF & "]" & SS & CC11
arg12 = "'" & Path & MM & "[" & FF & "]" & SS & CC12
arg13 = "'" & Path & MM & "[" & FF & "]" & SS & CC13
arg14 = "'" & Path & MM & "[" & FF & "]" & SS & CC14
arg15 = "'" & Path & MM & "[" & FF & "]" & SS & CC15
arg16 = "'" & Path & MM & "[" & FF & "]" & SS & CC16
arg17 = "'" & Path & MM & "[" & FF & "]" & SS & CC17
'
'
' Retrieve all data
GetValue1 = ExecuteExcel4Macro(arg1)
GetValue2 = ExecuteExcel4Macro(arg2)
GetValue3 = ExecuteExcel4Macro(arg3)
GetValue4 = ExecuteExcel4Macro(arg4)
GetValue5 = ExecuteExcel4Macro(arg5)
GetValue6 = ExecuteExcel4Macro(arg6)
GetValue7 = ExecuteExcel4Macro(arg7)
GetValue8 = ExecuteExcel4Macro(arg8)
GetValue9 = ExecuteExcel4Macro(arg9)
GetValue10 = ExecuteExcel4Macro(arg10)
GetValue11 = ExecuteExcel4Macro(arg11)
GetValue12 = ExecuteExcel4Macro(arg12)
GetValue13 = ExecuteExcel4Macro(arg13)
GetValue14 = ExecuteExcel4Macro(arg14)
GetValue15 = ExecuteExcel4Macro(arg15)
GetValue16 = ExecuteExcel4Macro(arg16)
GetValue17 = ExecuteExcel4Macro(arg17)
'
'
' Input data
sheets(a).Cells(6,7) = sheets(a).Cells(6,7) + GetValue1
sheets(a).Cells(7,7) = sheets(a).Cells(7,7) + GetValue2
sheets(a).Cells(10,7) = sheets(a).Cells(10,7) + GetValue3
sheets(a).Cells(11,7) = sheets(a).Cells(11,7) +GetValue4
sheets(a).Cells(12,7) = sheets(a).Cells(12,7) + GetValue5
sheets(a).Cells(14,7) = sheets(a).Cells(14,7) + GetValue6
sheets(a).Cells(15,7) = sheets(a).Cells(15,7) + GetValue7
sheets(a).Cells(16,7) = sheets(a).Cells(16,7) + GetValue8
sheets(a).Cells(17,7) = sheets(a).Cells(17,7) + GetValue9
sheets(a).Cells(18,7) = sheets(a).Cells(18,7) + GetValue10
sheets(a).Cells(20,7) = sheets(a).Cells(20,7) + GetValue11
sheets(a).Cells(21,7) = sheets(a).Cells(21,7) + GetValue12
sheets(a).Cells(23,7) = sheets(a).Cells(23,7) + GetValue13
sheets(a).Cells(24,7) = sheets(a).Cells(24,7) + GetValue14
sheets(a).Cells(25,7) = sheets(a).Cells(25,7) + GetValue15
sheets(a).Cells(26,7) = sheets(a).Cells(26,7) + GetValue16
sheets(a).Cells(27,7) = sheets(a).Cells(27,7) + GetValue17
next a
next b
End sub