Hi guys, i need some help. maybe you can help. i have 4 sheets, first sheet as a Master Sheet. second until fourth sheet act as a slave sheet. Whenever there are any change in "sold" column in slave sheets, it will fill and affect the amount in "sold" 's column in Master Sheet based on criteria in "ID" Column. I'm using sumif formula written in VBA, the problem is when the program executed, it wasn't work. The amount in "sold" column in master sheet didn't change, it's just affect first row and only blinking. Here's the code :
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim shops As Variant
Dim i as integer, j as integer, sale_result As Integer
Dim julat, jumlah
shops = Array("North_Shop", "South_Shop", "West_Shop")
For i = LBound(shops) To UBound(shops)
Set julat = Worksheets(shops(i)).Range("a6:a12")
Set jumlah = Worksheets(shops(i)).Range("c6:c12")
For j = 6 To 10
sale_result = Application.WorksheetFunction.SumIf(julat, Worksheets("Master_Shop").Cells(j, 1), jumlah)
Cells(j, 4).Value = sale_result
Next j
Next i
End Sub
and here's the sheet.
i'm noob in vba, i just really need help guys. thank you
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim shops As Variant
Dim i as integer, j as integer, sale_result As Integer
Dim julat, jumlah
shops = Array("North_Shop", "South_Shop", "West_Shop")
For i = LBound(shops) To UBound(shops)
Set julat = Worksheets(shops(i)).Range("a6:a12")
Set jumlah = Worksheets(shops(i)).Range("c6:c12")
For j = 6 To 10
sale_result = Application.WorksheetFunction.SumIf(julat, Worksheets("Master_Shop").Cells(j, 1), jumlah)
Cells(j, 4).Value = sale_result
Next j
Next i
End Sub
and here's the sheet.
i'm noob in vba, i just really need help guys. thank you