1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Private Sub Worksheet_Change(ByVal Target As Range)
Dim HQ1_GlobalCost As Integer
Dim HQ2_GlobalCost As Integer
'HQ 1
Set cel = Application.Intersect(Target, Range("A5"))
If Not cel Is Nothing Then
Range("B5") = Application.Index(Sheets(strSheet2).Range("A2:B5"), Application.Match(Range("A5"), Sheets(strSheet2).Range("A2:A5"), 0), 2)
End If
HQ1_GlobalCost = Application.Sum(Range("D7:K7"))
Range("B6") = HQ1_GlobalCost
'HQ 2
Set cel = Application.Intersect(Target, Range("A9"))
If Not cel Is Nothing Then
Range("B9") = Application.Index(Sheets(strSheet2).Range("A2:B5"), Application.Match(Range("A9"), Sheets(strSheet2).Range("A2:A5"), 0), 2)
End If
HQ2_GlobalCost = Application.Sum(Range("D11:K11"))
Range("B10") = HQ2_GlobalCost
End Sub |