Private Sub CommandButton1_Click()
Dim ta(), tb(), derligne&, i&, j&, m&
'-- paramétrage
derligne = Cells(Rows.Count, 3).End(3).Row
ta = Range("B10:Q" & derligne).Value
ReDim tb(1 To derligne - 9, 1 To 16)
m = 0
'--boucle tableau
For i = 1 To derligne - 9
If ta(i, 2) = Cells(7, "F") Then
m = m + 1
'-- pour les cellules sans modification
A = Array(1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16)
For j = LBound(A) To UBound(A)
tb(m, A(j)) = ta(i, A(j))
Next j
'-- pour les autres cellules
tb(m, 9) = "Ext. " & ta(i, 9)
tb(m, 10) = IIf(ta(i, 11) = "", "", ta(i, 11))
tb(m, 11) = IIf(ta(i, 10) = "", "", ta(i, 10))
End If
Next i
'-- restitution
Range("B" & (derligne + 1)).Resize(m, 16) = tb
End Sub