Sub prova()
For a = 2 To 35
If Foglio3.Cells(a, 2) <> Foglio2.Cells(3, 2).Value Then
Foglio3.Rows("3:3").Insert Shift:=xlDown
Range("A2").Select
Sheets("Dati").Select
Foglio3.Cells(3, 1).Value = Foglio2.Cells(2, 2).Value
Foglio3.Cells(3, 2).Value = Foglio2.Cells(3, 2).Value
Foglio3.Cells(3, 3).Value = Foglio2.Cells(4, 2).Value
Foglio3.Cells(3, 4).Value = Foglio2.Cells(5, 2).Value
Foglio3.Cells(3, 5).Value = Foglio2.Cells(6, 2).Value
Foglio3.Cells(3, 6).Value = Foglio2.Cells(7, 2).Value
Foglio3.Activate
[G3] = [C3 * E3]
[H3] = [C3 * F3]
[I3] = [G3 + H3]
[J3] = [C3 * 2.5]
[b3] = WorksheetFunction.Proper([b3])
[B2].CurrentRegion.Sort Key1:=[B1], order1:=xlAscending, Header:=xlYes
Foglio2.Activate
Range("B2:B8").ClearContents
If Foglio3.Cells(a, 2) = Foglio2.Cells(3, 2).Value Then
Foglio3.Cells(a, 4).Value = Foglio3.Cells(a, 4) + Foglio2.Cells(5, 2).Value
End If
Next a
End Sub |