جرب هدا
Sub SUMIF()
Dim WS As Worksheet: Set WS = Sheets("كشف حساب")
Dim sum As Double, Cnt As Long
WS.[Y1] = CDate(Me.DateMini)
Cnt = 0: sum1 = 0: sum2 = 0
On Error Resume Next
With ListBox1
For R = 0 To .ListCount - 1
Cnt = Cnt + 1
sum1 = sum1 + .List(R, 10)
sum2 = sum2 + .List(R, 11)
Next R
End With
Me.S.Caption = Cnt
TextBox3.Value = Format(sum1, "#,##00.00"): TextBox2.Value = Format(sum2, "#,##00.00")
tb = sum1 - sum2
TextBox1.Value = Format(tb, "#,##00.00")
tb1 = Evaluate("=SUM(SUMIFS('" & WS.Name & "'!G4:G100000,'" & WS.Name & _
"'!C4:C100000,{""مبيعات"";""قيد""},'" & WS.Name & "'!B4:B100000,""<=""&'" & WS.Name & "'!Y1))")
tb2 = Evaluate("=SUM(SUMIFS('" & WS.Name & "'!H4:H100000,'" & WS.Name & _
"'!C4:C100000,{""مردودات مبيعات"";""سند قيد"";""سند قبض""},'" & WS.Name & "'!B4:B100000,""<=""&'" & WS.Name & "'!Y1))")
result = tb1 - tb2
Me.Text_count.Value = Format(result, "#,##00.00")
End Sub
Copy of كشف حساب عميل V2.xlsm