Re : lancer une macro d'un autre classeur
j'ai modifiée mon code du coup il atteint bien la macro de mon autre classeur
nomfichier = "planningagent.xlsm"
'Lancer les userforms
Windows(classeur).Activate
Workbooks("planningagent").Sheets("planningagent").Range("A2").Value = UserForm1.Lst_id
'*****************************code qui plante*****************************
Application.Run "'" & nomfichier & "'" & "!maj_tab"
mais elle plante
Sub maj_tab()
'tempsdeb = Timer
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
ThisWorkbook.Sheets("planningagent").[C4:AG15].Interior.ColorIndex = xlNone
ThisWorkbook.Sheets("planningagent").[C4:AG15].ClearContents
nblignes = Sheets("dem").Range("A1").CurrentRegion.Rows.Count
With Sheets("dem")
For e = 2 To nblignes
If .Cells(e, 1) = nom Then
If .Cells(e, 2) <> "" Then
jd = Day(.Cells(e, 2))
md = Month(.Cells(e, 2))
absence = .Cells(e, 4)
With Sheets("planningagent").Range("B4").Offset(md - 1, jd)
.Value = Sheets("dem").Cells(e, 6)
.Interior.ColorIndex = [couleurs].Find(absence, lookat:=xlWhole).Interior.ColorIndex
End With
End If
End If
Next e
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
'tempsfin = Timer
'MsgBox Format(tempsfin - tempsdeb, "0.0") & " Secondes"
End Sub
message d'erreur "l'element portant ce nom est introuvable"