Bonjour,
J'essaye de créer 2 conditions à l'éxécution d'un code. Si l'une et/ou l'autre ne sont pas respectées, alors une ou deux Msgbox apparaissent, sinon mon code peut s'éxécuter. Pouvez-vous m'aider s'il vous plaît?
En détail, je voudrai écrire le code suivant:
Si M12 <> 1 et/ou D161 <> N4 alors
Msgbox "L'impression est impossible" (si M12<>1)
MsgBox "Attention votre profil est différent" (si D161 <> N4)
Sinon
Sheets("Synthèse client").Visible = True
Sheets("Synthèse client").PivotTables("Tableau croisé dynamique1").PivotCache.Refresh
Sheets("Synthèse client").Select
Range("F10:H36").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("F10:H36").Select
Selection.NumberFormat = "#,##0"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A7").Select
'Sheets("Synthèse client").PrintOut Copies:=2
'Sheets("Synthèse client").Visible = False
End If
Application.ScreenUpdating = True
End Sub
Merci de votre aide précieuse,
Mat
J'essaye de créer 2 conditions à l'éxécution d'un code. Si l'une et/ou l'autre ne sont pas respectées, alors une ou deux Msgbox apparaissent, sinon mon code peut s'éxécuter. Pouvez-vous m'aider s'il vous plaît?
En détail, je voudrai écrire le code suivant:
Si M12 <> 1 et/ou D161 <> N4 alors
Msgbox "L'impression est impossible" (si M12<>1)
MsgBox "Attention votre profil est différent" (si D161 <> N4)
Sinon
Sheets("Synthèse client").Visible = True
Sheets("Synthèse client").PivotTables("Tableau croisé dynamique1").PivotCache.Refresh
Sheets("Synthèse client").Select
Range("F10:H36").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("F10:H36").Select
Selection.NumberFormat = "#,##0"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A7").Select
'Sheets("Synthèse client").PrintOut Copies:=2
'Sheets("Synthèse client").Visible = False
End If
Application.ScreenUpdating = True
End Sub
Merci de votre aide précieuse,
Mat