I have a worksheet and I want to call multiple subs on multiple cell change events and cell.
In this worksheet, Range("K3") and Range("K32") are formula cells and I want to call calculation() for Range("K3") and calculation1() for Range("K32").
Please guide. Thanks
Private Sub Worksheet_Calculate()
Static MyOldVal
Static MyOldVal1
If Range("K3").Value <> MyOldVal Then
Call calculation
Else
If Cells(32, 11).Value <> MyOldVal1 Then Call calculation1
MyOldVal = Range("K3").Value
MyOldVal1 = Range("K32").Value
End If
End Sub
Private Sub calculation()
Cells(4, 10) = (Cells(11, 8) + Cells(16, 8) + Cells(28, 7) + (351 * Cells(25, 3))) / 0.9 / 0.7 * 1.2
Cells(5, 10) = (Cells(11, 8) + Cells(16, 8) + Cells(28, 7) + (351 * Cells(25, 3))) / 0.7 / 0.7 * 1.2
End Sub
Private Sub calculation1()
Cells(33, 10) = (Cells(40, 8) + Cells(45, 8) + Cells(57, 7) + (351 * Cells(54, 3))) / 0.9 / 0.7 * 1.2
Cells(34, 10) = (Cells(40, 8) + Cells(45, 8) + Cells(57, 7) + (351 * Cells(54, 3))) / 0.7 / 0.7 * 1.2
End Sub