beatrice2fr
XLDnaute Nouveau
bonjour
je voudrai savoir si la macro suivante peut etre simplifié car la procedure prend environ 10 bonnes secondes.....
j'explique un peu . vba examine le contenue de 2 cellules dans 2 feuilles differentes ( ce qui correspond a un repere ) et renvoie un msgbox pour chaque repere, si les conditions sont remplies. Est il possible que vba examine et ne renvoie qu'un seul message regroupant tous les reperes; du genre
"REP 1 /3 / 6 / 8 : VOIR GRANDE LONGEUR"
je voudrai savoir si la macro suivante peut etre simplifié car la procedure prend environ 10 bonnes secondes.....
j'explique un peu . vba examine le contenue de 2 cellules dans 2 feuilles differentes ( ce qui correspond a un repere ) et renvoie un msgbox pour chaque repere, si les conditions sont remplies. Est il possible que vba examine et ne renvoie qu'un seul message regroupant tous les reperes; du genre
"REP 1 /3 / 6 / 8 : VOIR GRANDE LONGEUR"
Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
On Error Resume Next
' premiere partie
If Sheets("CLOTURE").[D15] <> "" And Sheets("RC").[C4] = "" Then
MsgBox ("REP 1 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D16] <> "" And Sheets("RC").[I4] = "" Then
MsgBox ("REP 2 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D17] <> "" And Sheets("RC").[O4] = "" Then
MsgBox ("REP 3 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D18] <> "" And Sheets("RC").[U4] = "" Then
MsgBox ("REP 4 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D19] <> "" And Sheets("RC").[AA4] = "" Then
MsgBox ("REP 5 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D20] <> "" And Sheets("RC").[C26] = "" Then
MsgBox ("REP 6 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D21] <> "" And Sheets("RC").[I26] = "" Then
MsgBox ("REP 7 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D22] <> "" And Sheets("RC").[O26] = "" Then
MsgBox ("REP 8 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D23] <> "" And Sheets("RC").[U26] = "" Then
MsgBox ("REP 9 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D24] <> "" And Sheets("RC").[AA26] = "" Then
MsgBox ("REP 10 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D25] <> "" And Sheets("RC").[C48] = "" Then
MsgBox ("REP 11 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D26] <> "" And Sheets("RC").[I48] = "" Then
MsgBox ("REP 12 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D27] <> "" And Sheets("RC").[O48] = "" Then
MsgBox ("REP 13 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D28] <> "" And Sheets("RC").[U48] = "" Then
MsgBox ("REP 14 : VOIR GRANDE LONGEUR")
End If
If Sheets("CLOTURE").[D29] <> "" And Sheets("RC").[AA48] = "" Then
MsgBox ("REP 15 : VOIR GRANDE LONGEUR")
End If
' deuxieme partie
' procedure de valeur cible , mais la je ne pense pas que l'on puisse simplifié....
Sheets("WCL").[A9] = ""
Sheets("WCL").[V6].GoalSeek Goal:=Sheets("WCL").[W6], ChangingCell:=Sheets("WCL").[A9]
Sheets("WCL").[A70] = ""
Sheets("WCL").[V67].GoalSeek Goal:=Sheets("WCL").[W67], ChangingCell:=Sheets("WCL").[A70]
Sheets("WCL").[A132] = ""
Sheets("WCL").[V129].GoalSeek Goal:=Sheets("WCL").[W129], ChangingCell:=Sheets("WCL").[A132]
Sheets("WCL").[A194] = ""
Sheets("WCL").[V191].GoalSeek Goal:=Sheets("WCL").[W191], ChangingCell:=Sheets("WCL").[A194]
Sheets("WCL").[A256] = ""
Sheets("WCL").[V253].GoalSeek Goal:=Sheets("WCL").[W253], ChangingCell:=Sheets("WCL").[A256]
Sheets("WCL").[A318] = ""
Sheets("WCL").[V315].GoalSeek Goal:=Sheets("WCL").[W315], ChangingCell:=Sheets("WCL").[A318]
Sheets("WCL").[A344] = ""
Sheets("WCL").[V341].GoalSeek Goal:=Sheets("WCL").[W341], ChangingCell:=Sheets("WCL").[A344]
Sheets("WCL").[A371] = ""
Sheets("WCL").[V368].GoalSeek Goal:=Sheets("WCL").[W368], ChangingCell:=Sheets("WCL").[A371]
Sheets("WCL").[A397] = ""
Sheets("WCL").[V394].GoalSeek Goal:=Sheets("WCL").[W394], ChangingCell:=Sheets("WCL").[A397]
Sheets("WCL").[A423] = ""
Sheets("WCL").[V420].GoalSeek Goal:=Sheets("WCL").[W420], ChangingCell:=Sheets("WCL").[A423]
Sheets("WCL").[A449] = ""
Sheets("WCL").[V446].GoalSeek Goal:=Sheets("WCL").[W446], ChangingCell:=Sheets("WCL").[A449]
Sheets("WCL").[A475] = ""
Sheets("WCL").[V472].GoalSeek Goal:=Sheets("WCL").[W472], ChangingCell:=Sheets("WCL").[A475]
Sheets("WCL").[A501] = ""
Sheets("WCL").[V498].GoalSeek Goal:=Sheets("WCL").[W498], ChangingCell:=Sheets("WCL").[A501]
Sheets("WCL").[A527] = ""
Sheets("WCL").[V524].GoalSeek Goal:=Sheets("WCL").[W524], ChangingCell:=Sheets("WCL").[A527]
Sheets("WCL").[A553] = ""
Sheets("WCL").[V550].GoalSeek Goal:=Sheets("WCL").[W550], ChangingCell:=Sheets("WCL").[A553]
Application.ScreenUpdating = True
On Error GoTo 0
End Sub