Bonjour,
Je tente de simplifier la portion rouge du code suivant mais sans succès. J'aimerai la nommer avec un nom puisqu'elle est répétée souvent dans la procédure.
Merci pour votre aide
MMaatthh
....
Dim acell As Range
....
For i = 1 To 8
If Cells(acell.Row, 1) = i And (acell.Column = 10 - i Or acell.Column = 18 - i Or acell.Column = 26 - i Or acell.Column = 34 - i Or acell.Column = 42 - i) Then
Set Found = Range(Cells(ligneCmdtH, acell.Column), Cells(ligneCmdtB, acell.Column)).Find("D")
If acell = "" _
And Found Is Nothing _
And UCase(acell.Offset(0, -1)) <> "S" _
And UCase(acell.Offset(0, -1)) <> "N" _
And UCase(Cells(acell.Row, 3)) = "D8" _
And (UCase(Cells(4, acell.Column)) = UCase(Range("AP7")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP8")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP9")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP10")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP11")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP12")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP13"))) Then
acell = "D"
ElseIf acell = "" _
And Found Is Nothing _
And UCase(acell.Offset(0, -1)) <> "S" _
And UCase(acell.Offset(0, -1)) <> "N" Then
acell = "J"
End If
End If
Je tente de simplifier la portion rouge du code suivant mais sans succès. J'aimerai la nommer avec un nom puisqu'elle est répétée souvent dans la procédure.
Merci pour votre aide
MMaatthh
....
Dim acell As Range
....
For i = 1 To 8
If Cells(acell.Row, 1) = i And (acell.Column = 10 - i Or acell.Column = 18 - i Or acell.Column = 26 - i Or acell.Column = 34 - i Or acell.Column = 42 - i) Then
Set Found = Range(Cells(ligneCmdtH, acell.Column), Cells(ligneCmdtB, acell.Column)).Find("D")
If acell = "" _
And Found Is Nothing _
And UCase(acell.Offset(0, -1)) <> "S" _
And UCase(acell.Offset(0, -1)) <> "N" _
And UCase(Cells(acell.Row, 3)) = "D8" _
And (UCase(Cells(4, acell.Column)) = UCase(Range("AP7")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP8")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP9")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP10")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP11")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP12")) _
Or UCase(Cells(4, acell.Column)) = UCase(Range("AP13"))) Then
acell = "D"
ElseIf acell = "" _
And Found Is Nothing _
And UCase(acell.Offset(0, -1)) <> "S" _
And UCase(acell.Offset(0, -1)) <> "N" Then
acell = "J"
End If
End If