Voici le code que j'ai pour le moment et qui fonctionne bien.
' Clear content of the target column
Worksheets("Sheet2").Select
Range("target_table").Columns(2).Clear
'Copy the whole input column of Sheet1 to the corresponding one in Sheet2
Worksheets("Sheet1").Range("input_table").Columns(2).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Worksheets("Sheet2").Range("target_table").Columns(2) ', _
'Unique:=True
'resize the table
With Worksheets("Sheet2")
.ListObjects("target_table").Resize .Range("B2").CurrentRegion
End With
'delete every content after "("
Dim Cell As Range
Dim content As String
For Each Cell In Sheets("Sheet2").Range("target_col")
'MsgBox (Cell.Value)
If Not IsNumeric(Cell) And Cell <> "" Then
pos = InStr(Cell, "(")
If pos > 0 Then
Cell = Left(Cell, pos - 1)
End If
End If: Next Cell
'remove duplicates in target_table
Range("target_table").RemoveDuplicates Columns:=2, Header _
:=xlYes
J'aimerais bien savoir pourquoi ...
'Copy the whole column step type of the sheet1 to the corresponding one in Sheet2
Worksheets("Sheet1").Range("input_table").Columns(2).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Worksheets("Sheet2").Range("target_table").Columns(2) ', _
'Unique:=True
... la commande Unique:=True marche bien, sauf pour la première valeur du tableau qui apparaît donc 2 fois dans le tableau target. si quelqu'un peut m'expliqer pourquoi ?