1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Sub remplirCellules()
Dim j As Long: j = 1
Dim k As Long: k = 70
Dim m As Long: m = 71
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
sh.Range("ab70:ab1000").ClearContents 'effacer les anciennes valeurs
If sh.Cells(j, 3) = "Texte 1" Then
sh.Cells(k, 28) = "Texte 1"
Else
sh.Cells(k, 28) = "Texte 1"
sh.Cells(m, 28) = "Texte 2"
End If
j = j + 1
With sh
Do While True
If .Cells(j, 3) = "" Then Exit Do
If .Cells(j, 3) = "Texte1" Then
.Cells(Rows.Count, 28).End(xlUp).Offset(1, 0) = "Texte 1"
Else
.Cells(Rows.Count, 28).End(xlUp).Offset(1, 0) = "Texte 1"
.Cells(Rows.Count, 28).End(xlUp).Offset(1, 0) = "Texte 2"
End If
j = j + 1
Loop
End With
Set sh = Nothing
End Sub |
Partager