hi,
I got this macro below.
How could I use my variable "nameofthedata" to replace "LOUIS1001.xlsm"
in the line
Application.Run "LOUIS1001.xlsm!start"
I would like to use my variable for the loop to work...
i =LOUIS1001.xlsm, next i is LOUIS1002.xlsm,...etc. there is 20 "i"s
I got this macro below.
How could I use my variable "nameofthedata" to replace "LOUIS1001.xlsm"
in the line
Application.Run "LOUIS1001.xlsm!start"
I would like to use my variable for the loop to work...
i =LOUIS1001.xlsm, next i is LOUIS1002.xlsm,...etc. there is 20 "i"s
Code:
Sub weekend()
Dim nameofthedata As String
Dim i As Integer
i = 1
For i = 1 To 20
nameofthedata = Worksheets("DATAlist").Cells(i, 1).Value
Workbooks.Open Filename:= _
"C:\Users\Louis-Philippe\Documents\DATA\" & nameofthedata & ""
Application.Run "LOUIS1001.xlsm!start"
Workbooks(nameofthedata).Close savechanges:=True
ThisWorkbook.Activate
'reset
nameofthedata = 0
Next i
End Sub