Sub Corrispettivi()
Sheets("Corrispettivi").Rows("4:4").Insert Shift:=xlDown
'Sheets("Corrispettivi").Select
'Rows("3:3").Select
'Rows("4:4").Select
'Selection.Insert Shift:=xlDown
Range("A3").Select
Sheets("HomePage").Select
Foglio13.Cells(4, 1).Value = Foglio1.Cells(6, 3).Value
Foglio13.Cells(4, 2).Value = Foglio1.Cells(26, 15).Value
Foglio13.Cells(4, 3).Value = Foglio1.Cells(22, 7).Value
Foglio13.Cells(4, 4).Value = Foglio1.Cells(8, 15).Value
Foglio13.Cells(4, 5).Value = Foglio1.Cells(10, 15).Value
Foglio13.Cells(4, 6).Value = Foglio1.Cells(12, 15).Value
Foglio13.Cells(4, 7).Value = Foglio1.Cells(14, 15).Value
Foglio13.Cells(4, 8).Value = Foglio1.Cells(16, 15).Value
Foglio13.Cells(4, 9).Value = Foglio1.Cells(18, 15).Value
Foglio13.Cells(4, 10).Value = Foglio1.Cells(20, 15).Value
Foglio13.Cells(4, 11).Value = Foglio1.Cells(22, 15).Value
Range("O26") = Range("O26") + 1
Sheets("Corrispettivi").Select
Dim r As Integer
Dim Corrispettivi As Double, Prodotti As Double
Dim rifmin As Integer, rifmax As Integer
Dim primo As Boolean
For r = 4 To 500
If Cells(r, 1) = [a1] Then
Corrispettivi = Corrispettivi + Cells(r, 11)
Prodotti = Prodotti + Cells(r, 10)
Do While primo = False
rifmin = Cells(r, 2)
primo = True
Loop
If Cells(r, 2) < rifmin Then rifmin = Cells(r, 2)
If Cells(r, 2) > rifmax Then rifmax = Cells(r, 2)
End If
Next r
[a2] = Corrispettivi
[c2] = Prodotti
[b2] = Corrispettivi - Prodotti
[D2] = rifmin
[E2] = rifmax
For a = 8 To 500
If Foglio20.Cells(a, 2).Value = Cells(1, 1).Value Then
Foglio20.Cells(a, 3).Value = Cells(2, 1).Value
Foglio20.Cells(a, 4).Value = Cells(2, 2).Value
Foglio20.Cells(a, 5).Value = Cells(2, 3).Value
Foglio20.Cells(a, 6).Value = [D2] & "/" & [E2]
End If
Next a
Sheets("HomePage").Select
End Sub |