1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Sub Tri()
Set début = Range("A1")
Ncol = début.CurrentRegion.Columns.Count
début.Offset(, Ncol).EntireColumn.Insert Shift:=xlToRight
Set Rng1 = début.CurrentRegion.Offset(, Ncol - 1).Resize(, 1)
Set Rng2 = début.CurrentRegion.Offset(, Ncol).Resize(, 1)
Rng2.Value = Rng1.Value
Rng2.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
Rng2.Value = Rng2.Value
début.CurrentRegion.Sort Key1:=Cells(2, Ncol + 1), Order1:=xlAscending, _
Key2:=Cells(2, 1), Order2:=xlAscending, Header:=xlGuess
Cells(1, Ncol + 1).EntireColumn.Delete
[A1].Select
End Sub |