VB Code:
Case "Credit"
gSheet.Rows(j).EntireRow.Copy tSheet.Rows(j)
For l = 5 To 350
Select Case gSheet.Cells(l, 1).Value
Case "W3900"
For m = l To gSheet.Cells(l, 2).End(xlDown).Row
Select Case gSheet.Cells(m, 2).Value
Case gSheet.Cells(j, 2).Value
gSheet.Activate
gSheet.Range(Cells(m, 3), Cells(m, 3).End(xlToRight)).Copy
tSheet.Activate
tSheet.Range(Cells(j, 3), Cells(j, 3).End(xlToRight)).PasteSpecial Paste:=xlValues, operation:=xlAdd
Application.CutCopyMode = False
End Select
Next m
Case "Z3988"
For m = l To gSheet.Cells(l, 2).End(xlDown).Row
Select Case gSheet.Cells(m, 2).Value
Case gSheet.Cells(j, 2).Value
gSheet.Activate
gSheet.Range(Cells(m, 3), Cells(m, 3).End(xlToRight)).Copy
tSheet.Activate
tSheet.Range(Cells(j, 3), Cells(j, 3).End(xlToRight)).PasteSpecial Paste:=xlValues, operation:=xlAdd
Application.CutCopyMode = False
End Select
Next m
Case "N3394"
For m = l To gSheet.Cells(l, 2).End(xlDown).Row
Select Case gSheet.Cells(m, 2).Value
Case gSheet.Cells(j, 2).Value
gSheet.Activate
gSheet.Range(Cells(m, 3), Cells(m, 3).End(xlToRight)).Copy
tSheet.Activate
tSheet.Range(Cells(j, 3), Cells(j, 3).End(xlToRight)).PasteSpecial Paste:=xlValues, operation:=xlSubtract
Application.CutCopyMode = False
End Select
Next m
Case "3472Hen"
For m = l To gSheet.Cells(l, 2).End(xlDown).Row
Select Case gSheet.Cells(m, 2).Value
Case gSheet.Cells(j, 2).Value
gSheet.Activate
gSheet.Range(Cells(m, 3), Cells(m, 3).End(xlToRight)).Copy
tSheet.Activate
tSheet.Range(Cells(j, 3), Cells(j, 3).End(xlToRight)).PasteSpecial Paste:=xlValues, operation:=xlSubtract
Application.CutCopyMode = False
End Select
Next m
End Select
Next l