Bonjour,
J'ai 12 macros comme celles ci-dessous qui travaillent sur une même feuille.
Sub chaines_cpa1()
Dim i As Integer, j As Integer
Dim Chaine As String
Range("AJ24") = ""
If WorksheetFunction.CountIf(Range("D14:AH14"), "Cpa") Then
For i = 4 To 34
If Cells(14, i) = "Cpa" Then
For j = i To 35
If Cells(14, j) <> "Cpa" Then
If Chaine = "" Then
Chaine = " du " & Cells(10, i) & " au " & Cells(10, j - 1)
Else
Chaine = Chaine & " et du " & Cells(10, i) & " au " & Cells(10, j - 1)
End If
i = j
Exit For
End If
Next
End If
Next
End If
Range("AJ24") = Chaine
End Sub
Option Explicit
Sub chaines_css1()
Dim i As Integer, j As Integer
Dim Chaine As String
Range("AJ25") = ""
If WorksheetFunction.CountIf(Range("D14:AH14"), "Css") Then
For i = 4 To 34
If Cells(14, i) = "Css" Then
For j = i To 35
If Cells(14, j) <> "Css" Then
If Chaine = "" Then
Chaine = " du " & Cells(10, i) & " au " & Cells(10, j - 1)
Else
Chaine = Chaine & " et du " & Cells(10, i) & " au " & Cells(10, j - 1)
End If
i = j
Exit For
End If
Next
End If
Next
End If
Range("AJ25") = Chaine
End Sub
Sachant que la différence entre elles est le critère recherché et en fonction de ce critère l'emplacement du Range, est-il possible de les assembler pour n'en faire qu'une ?
Si oui pouriez-vous maiguiller svp
.