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
|
Sub TriMC2()
Set rng1 = Range("A2:A10,C2:C10") ' à adapter
Dim temp(), temp2()
ReDim temp(rng1.Count)
ReDim temp2(rng1.Count)
lig = 0
For i = 1 To rng1.Areas.Count
For j = 1 To rng1.Areas(i).Count
If rng1.Areas(i)(j) <> "" Then
lig = lig + 1
temp(lig) = rng1.Areas(i)(j)
temp2(lig) = rng1.Areas(i)(j).Offset(, 1)
End If
Next j
Next i
Call Tri2(temp, temp2, 1, lig)
lig = 0
For i = 1 To rng1.Areas.Count
For j = 1 To rng1.Areas(i).Count
lig = lig + 1
rng1.Areas(i)(j) = temp(lig)
rng1.Areas(i)(j).Offset(, 1) = temp2(lig)
Next j
Next i
End Sub |
Partager