Hello people,
I need help.
I am trying to do a balance check, I have tried in several ways and I cannot continue.
Today I am using the formula and would like to switch to Vba.
Below the formula I am using in column V to the last line with information in column D.
FORMULA: =TRUNC(IF(G4="ATIVA";IF(M4="CREDIT";L4-SUMIFS(L:L;S:S;D4;G:G;"ATIVA");0);0);2)
Below the formula, I am writing in VBA and it is not working.:
If anyone can help me correct or reconstruct my VBA formula, I appreciate it.
Tks
EXEMPLE
I need help.
I am trying to do a balance check, I have tried in several ways and I cannot continue.
Today I am using the formula and would like to switch to Vba.
Below the formula I am using in column V to the last line with information in column D.
FORMULA: =TRUNC(IF(G4="ATIVA";IF(M4="CREDIT";L4-SUMIFS(L:L;S:S;D4;G:G;"ATIVA");0);0);2)
Below the formula, I am writing in VBA and it is not working.:
VBA Code:
Sub CALCULATE_BALANCE()
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationManual
linha1 = 3
With Sheets("CONTROL")
For Cont = 4 To Cells(Rows.Count, 4).End(xlUp).Row
Set rng1 = .Cells(linha1 + 1, 4)
ActiveSheet.Cells(linha1 + 1, 22).Value = WorksheetFunction.SumIfs(.Range("L4:L" & Cont), .Range("G4:G" & Cont), "ATIVA", .Range("M4:M" & Cont), "CREDIT")
linha1 = linha1 + 1
Next Cont
End With
Application.Calculation = xlCalculationAutomatic
Application.DisplayStatusBar = True
Application.ScreenUpdating = True
End Sub
If anyone can help me correct or reconstruct my VBA formula, I appreciate it.
Tks
EXEMPLE