1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| Sub startupdate()
Dim Rep As String
Dim REPER As String
Dim tv
Dim lg As Byte
lg = 44
If IsEmpty(Range("E" & lg)) Then Range("E" & lg) = 0
If IsEmpty(Range("F" & lg)) Then Range("F" & lg) = 0
If IsEmpty(Range("G" & lg)) Then Range("G" & lg) = 0
tv = Range("E" & lg) & ":" & Range("F" & lg) & ":" & Range("G" & lg)
Rep = "Gestion:contrats de recherche:Base Contrats:"
REPER = "Gestion:Echanges_et_comptes_a_suivre:"
Workbooks.Open Rep & "AERES.xls"
Windows(1).WindowState = xlMinimized
Workbooks.Open REPER & "Gregory_Echanges_entre_equipes.xlsm"
Windows(1).WindowState = xlMinimized
Application.OnTime Now + TimeValue(tv), "som"
End Sub
Sub som()
Dim depart, fin
depart = Now
'....code lines of macro som
Dim MasterWbk As Workbook
Dim i As Long, cel As Range
Dim passwords
Application.ScreenUpdating = False
Set MasterWbk = ThisWorkbook
passwords = Array("aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm", "nnn", "ooo", "ppp", "qqq", "rrr", "sss", "ttt")
MasterWbk.ActiveSheet.[C4:G7,C10:G18,C20:G21,C23:G26,C29:G32,C34:G37,L4:P7,L10:P18,L20:P21,L23:P26,L29:P32,L34:P37].ClearContents
For i = 1 To 20
Workbooks.Open "Gestion:web:telechargement:BD_equipe_" & i & ".xlsm", UpdateLinks:=3, Password:=passwords(i - 1)
For Each cel In Sheets("Recap1").[C4:G7,C10:G18,C20:G21,C23:G26,C29:G32,C34:G37,L4:P7,L10:P18,L20:P21,L23:P26,L29:P32,L34:P37]
MasterWbk.ActiveSheet.Range(cel.Address) = MasterWbk.ActiveSheet.Range(cel.Address) + cel.Value
Next cel
ActiveWorkbook.Close False
Next i
Workbooks("AERES.xls").Close SaveChanges:=False
Workbooks("Gregory_Echanges_entre_equipes.xlsm").Close SaveChanges:=True
fin = Now
MsgBox Format(fin - depart, "hh:mm:ss")
End Sub |
Partager