J'ai 4 macros qui fonctionnent parfaitement.
Je souhaiterais lancer 3 macros si en J4 =2 et 3 macros si en J4 = 1
j'ai fait ça...mais ça plante, quelle est la bonne syntaxe ?
Sub Archiver_Pdf_Raz()
If Range("J4").Value = 2 Then
Call OptimiseTempsExecArchivlign15
Else
Call EnregDevisFormulaire_Pdf
Else
Call RAZ
End If
If Range("J4").Value = 1 Then
Call OptimiseTempsExecArchivlign15
Else
Call EnregFactures_Pdf
Else
Call RAZ
End If
Bonjour.
Dans la bonne syntaxe d'un bloc If il ne peut y avoir qu'un sous bloc Else en dernier avant le End If
Mais avant lui il peut y avoir après le bloc If condition1 Then plusieurs sous blocs ElseIf conditionx Then
Dans votre cas il vaudrait mieux Select Case Range("J4").Value
Case 1: OptimiseTempsExecArchivlign15: EnregDevisFormulaire_Pd
Case 2: OptimiseTempsExecArchivlign15: EnregFactures_Pdf
Case Else: RAZ: End Select
Sub Archiver_Pdf_Raz()
Call OptimiseTempsExecArchivlign15
If Range("J4").Value = 2 Then
Call EnregDevisFormulaire_Pdf
Call RAZ
End If
If Range("J4").Value = 1 Then
Call EnregFactures_Pdf
Call RAZ
End If
End Sub