
Sub WorkSheet_Calculate()
Dim i As Integer
i = [b1]
Static ValoreDaControllare_b3
With Range("b3") '<----- cella da controllare
If Range("b3") = Cells(i, 2) Then
Range(Cells(i, 3), Cells(i, 4)) = Range("c3:d3").Value
Application.EnableEvents = False
Cells(i, 5).FormulaArray = "=+ROUND(SUM(R4C[-2]:INDIRECT(""c""&R1C2)*R4C[-1]:INDIRECT(""d""&R1C2))/SUM(R4C[-1]:INDIRECT(""d""&R1C2)),3)"
Cells(i, 5).Value = Cells(i, 5)
'Application.EnableEvents = True
ValoreDaControllare_b3 = .Value
End If
End With
End Sub
|
Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim i As Integer
Static ValoreDaControllare_b3
with sh
i = .range("b1")
If .Range("b3") = .Cells(i, 2) Then
.Range(.Cells(i, 3), .Cells(i, 4)) = .Range("c3:d3").Value
Application.EnableEvents = False
.Cells(i, 5).FormulaArray = "=+ROUND(SUM(R4C[-2]:INDIRECT(""c""&R1C2)*R4C[-1]:INDIRECT(""d""&R1C2))/SUM(R4C[-1]:INDIRECT(""d""&R1C2)),3)"
.Cells(i, 5).Value = .Cells(i, 5)
'Application.EnableEvents = True
ValoreDaControllare_b3 = .Value
End If
End With
End Sub |
