...
Ho veramente tanti dati da estrapolare...
Grazie per l'eventuale supporto vorrete gentilmente darmi.
In attesa...saluto.
Ciao,
prova con la macro allegata da copiare in un modulo generale del file che contiene i dati. Prima di eseguire la macro, modifica nella riga evidenziata il nome del foglio contenente i dati.
Se non hai mai utilizzato il vba, prima di tutto leggi Dove e come inserire il codice VBA.
Andrea.
Public Sub SplitDataInColumns()
Dim dicField As Object, dicName As Object ' Scripting.Dictionary
Dim vbData As Variant, f As Variant
Dim sCurrentName As String
Dim r As Long
On Error GoTo Uffa
'--- set working range
With ThisWorkbook.Worksheets("Foglio1")
r = .Cells(Rows.Count, 1).End(xlUp).Row
vbData = .UsedRange.Resize(r, 2).Value
End With
'--- build unique fields in list
Set dicField = CreateObject("Scripting.Dictionary")
For r = 1 To UBound(vbData)
If Len(vbData(r, 1)) Then dicField(Trim(vbData(r, 1))) = 0
Next
'--- a wrapper for data
Set dicName = CreateObject("Scripting.Dictionary")
'--- make the dictionary case insensitive?
'dicName.CompareMode = vbTextCompare
For r = 1 To UBound(vbData)
If Trim(vbData(r, 1)) = "Nome" Then
sCurrentName = Trim(vbData(r, 2))
'--- add a new record
Set dicName(sCurrentName) = CreateObject("Scripting.Dictionary")
For Each f In dicField
dicName(sCurrentName)(f) = vbNullString
Next
End If
'-- add data fields
If Len(sCurrentName) Then
If dicName.exists(sCurrentName) Then dicName(sCurrentName)(Trim(vbData(r, 1))) = Trim(vbData(r, 2))
End If
Next
'--- paste results
Application.ScreenUpdating = False
With ThisWorkbook.Worksheets.Add()
'--- field names
.[a1].Resize(, dicField.Count).Value = dicField.keys
With Intersect(.UsedRange, Rows(1))
.Font.Bold = True
.HorizontalAlignment = xlCenter
End With
'--- data
r = 1
For Each f In dicName
r = r + 1
.Cells(r, 1).Resize(, dicField.Count).Value = dicName(f).items
Next
With .UsedRange
.Sort [a1], xlAscending, Header:=xlYes
.EntireColumn.AutoFit
End With
End With
exitSub:
'--- clean up
Set dicName = Nothing: Set dicField = Nothing
Exit Sub
Uffa:
Call MsgBox("Si è verificato un errore: " & vbNewLine & _
CStr(Err.Number) & " - " & Err.Description & vbNewLine & vbNewLine & _
r & " - " & sCurrentName & " - " & vbData(r, 1) & " - " & vbData(r, 2), vbCritical, "Error message")
Resume exitSub
End Sub