Public NumFog As Long, NumRig As Long, NumRTot As Long, I As Long, Riep As Object
Sub Copia_Dati()
Set Riep = Sheets("Riepilogo") ' <--- Da modificare eventualmente nome foglio del riepilogo
NumRig = 0
NumFog = Worksheets.Count ' <--- In questo modo si possono aggiungere altri fogli
NumRTot = Riep.Range("A1500").End(xlUp).Row
Application.ScreenUpdating = False
If NumRTot > 1 Then
Riep.Select
Range(Cells(1, 1), Cells(NumRTot, 16)).ClearContents
NumRTot = 1
End If
For I = 1 To NumFog
If Sheets(I).Name <> Riep.Name Then
NumRig = Sheets(I).Range("A65536").End(xlUp).Row
Sheets(I).Select
Range(Cells(1, 1), Cells(NumRig, 16)).Copy Destination:=Riep.Cells(NumRTot, 1)
NumRTot = NumRTot + NumRig - 1
End If
Next I
Riep.Select
Application.ScreenUpdating = True
End Sub
|