Salut 2bestof,
Salut njhub,
par macro à coller dans le module VBA de la feuille .cvs brute.
Un double-clic dans cette feuille démarre la macro qui crée une feuille 'Extract' pour l'affichage des résultats.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'
Dim tTab, iRow%, iStart%, iEnd%, sNom$
'
Cancel = True
Application.ScreenUpdating = False
'
For x = 1 To Sheets.Count
If Sheets(x).Name = "Extract" Then iRow = 1
Next
If iRow = 0 Then Sheets.Add.Name = "Extract"
'
iRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:D" & iRow).Sort key1:=Range("A2"), order1:=xlAscending, key2:=Range("C2"), order2:=xlAscending, Orientation:=xlTopToBottom
iStart = WorksheetFunction.Min(Range("C2:C" & iRow))
iEnd = WorksheetFunction.Max(Range("C2:C" & iRow))
tTab = Range("A2:D" & iRow).Value
iRow = 1
'
With Worksheets("Extract")
.Cells.Delete
.Cells.NumberFormat = "General"
.Cells.HorizontalAlignment = xlHAlignRight
.Rows(1).HorizontalAlignment = xlHAlignCenter
.Columns(1).HorizontalAlignment = xlHAlignLeft
.Cells(1, 1) = "Pays"
.Cells(1, 2) = "Continent"
.Cells(1, 3) = iStart
.Range("C1").DataSeries Rowcol:=xlRows, Type:=xlChronological, step:=1, Stop:=iEnd
For x = 1 To UBound(tTab, 1)
If tTab(x, 1) <> sNom Then
iRow = iRow + 1
sNom = tTab(x, 1)
.Cells(iRow, 1) = tTab(x, 1)
End If
.Cells(iRow, .Rows(1).Find(what:=tTab(x, 3), lookat:=xlWhole, LookIn:=xlValues, searchdirection:=xlNext).Column) = "'" & tTab(x, 4)
Next
.UsedRange.Borders.LineStyle = xlContinuous
.UsedRange.BorderAround Weight:=xlMedium
.Columns.AutoFit
.Activate
End With
'
Application.ScreenUpdating = True
'
End Sub
A+