
Sub riepilogo()
Application.ScreenUpdating = False
r = Sheets("riepilogo ordinato").Range("b" & Rows.Count).End(xlUp).Row
For i = 2 To Sheets.Count - 1
k = Sheets(i).Range("b2").End(xlDown).Row
Sheets("riepilogo ordinato").Range("a" & r + 1 & ":y" & r + k - 1) = Sheets(i).Range("a2:y" & k).Value
r = r + k - 1
Next
Range("a2:y" & r).Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlNo
Application.ScreenUpdating = True
End Sub
|
Application.ScreenUpdating = False
r = Sheets("riepilogo ordinato").Range("b" & Rows.Count).End(xlUp).Row
For i = 2 To Sheets.Count - 1
k = Sheets(i).Range("b2").End(xlDown).Row
Sheets("riepilogo ordinato").Range("a" & r + 1 & ":y" & r + k - 1) = Sheets(i).Range("a2:y" & k).Value
r = r + k - 1
Next
Range("a2:y" & r).Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlNo
For i = r To 2 Step -1
If Cells(i, 2) = Cells(i - 1, 2) And Cells(i, 5) = Cells(i - 1, 5) And Cells(i, 7) = Cells(i - 1, 7) And Cells(i, 8) = Cells(i - 1, 8) Then
arr = Array(Cells(i, 11), Cells(i, 12), Cells(i, 13), Cells(i, 14), Cells(i, 15), Cells(i, 16), Cells(i, 17), Cells(i, 18), Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i, 23), Cells(i, 24))
For Each ce In arr
If ce <> "" Then
ce.Offset(-1, 0) = ce.Offset(-1, 0) + ce.Value
End If
Next
Rows(i).Delete
End If
Next
Application.ScreenUpdating = True
|
For i = r To 2 Step -1
If Cells(i, 2) = Cells(i - 1, 2) And Cells(i, 5) = Cells(i - 1, 5) And Cells(i, 7) = Cells(i - 1, 7) And Cells(i, 8) = Cells(i - 1, 8) Then
arr = Array(Cells(i, 11), Cells(i, 12), Cells(i, 13), Cells(i, 14), Cells(i, 15), Cells(i, 16), Cells(i, 17), Cells(i, 18), Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i, 23), Cells(i, 24))
For Each ce In arr
If ce <> "" Then
ce.Offset(-1, 0) = ce.Offset(-1, 0) + ce.Value
End If
Next
Rows(i).Delete
End If
Next |
Sub riepilogoaccorpa()
Application.ScreenUpdating = False
r = Sheets("riepilogo ordinato").Range("b" & Rows.Count).End(xlUp).Row
For i = 2 To Sheets.Count - 1
k = Sheets(i).Range("b2").End(xlDown).Row
Sheets("riepilogo ordinato").Range("a" & r + 1 & ":y" & r + k - 1) = Sheets(i).Range("a2:y" & k).Value
r = r + k - 1
Next
Range("a2:y" & r).Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlNo
For i = r To 2 Step -1
If Cells(i, 2) = Cells(i - 1, 2) And Cells(i, 5) = Cells(i - 1, 5) And Cells(i, 7) = Cells(i - 1, 7) And Cells(i, 8) = Cells(i - 1, 8) And Cells(i, 9) = Cells(i - 1, 9) And Cells(i, 10) = Cells(i - 1, 10) Then
arr = Array(Cells(i, 11), Cells(i, 12), Cells(i, 13), Cells(i, 14), Cells(i, 15), Cells(i, 16), Cells(i, 17), Cells(i, 18), Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i, 23), Cells(i, 24))
For Each ce In arr
If ce <> "" Then
ce.Offset(-1, 0) = ce.Offset(-1, 0) + ce.Value
End If
Next
Rows(i).Delete
End If
Next
Application.ScreenUpdating = True
End Sub |
