Ho imbastito questa macro che però mi riporta sempre e solo un valore .
- Codice: Seleziona tutto
Option Explicit
Sub Ricerca()
Dim Ur1, Ur2 As Integer, X As Integer, Z As Integer
Dim ws As Worksheet
Dim Ws1 As Worksheet
Application.ScreenUpdating = False
Set Ws1 = Sheets("Destinazione") '<<< fo di destinazione + Elenco di ricerca
Ur1 = Ws1.Cells(Rows.Count, 5).End(xlUp).Row ' col. con i riferimenti su ws1
'
Ws1.Range("F8:J" & Ur1).ClearContents
For Each ws In ThisWorkbook.Worksheets
Ur2 = ws.Cells(Rows.Count, 5).End(xlUp).Row
If ws.Name <> "Destinazione" Then
For X = 8 To Ur1 ' riga di partenza su foglio origine
For Z = 8 To Ur2 ' idem su ws = altri fogli
If Ws1.Cells(X, 5) = ws.Cells(Z, 5) Then ' cerca uguaglianza tra i codici di riferimento ,
' se trova uguaglianza copia le celle , stssa riga, a partire dalla col. successiva x 5 colonne
ws.Cells(X, 6).Resize(, 4).Copy Destination:=Ws1.Cells(X, 6) 'copia riga corrispondente
End If
Next Z
Next X
End If
Next ws
Application.ScreenUpdating = True
Set Ws1 = Nothing
End Sub
se serve aggiungo il file test.
