اذهب الي المحتوي
أوفيسنا

كود جلب إسم العميل مع المتبقى له او عليه سواء مدين او دائن


إذهب إلى أفضل إجابة Solved by حسين مامون,

الردود الموصى بها

  • أفضل إجابة

ضع هذا الماكرو في مديول

غير اسم الشيت الديون الى data1

واسم الشيت العملاء data2

او غير رهما في الماكرو الى العربي في الصف الثالث والرابع

Sub test()
Dim ws As Worksheet
Dim ws2 As Worksheet
Set ws = Sheets("data1")
Set ws2 = Sheets("data2")
Dim lr, lr2, x, xx, x1, x2, y
Application.ScreenUpdating = False
lr = ws.Cells(Rows.Count, "c").End(3).Row
lr2 = ws2.Cells(Rows.Count, "b").End(3).Row
For xx = 2 To lr2

For x = 6 To lr
If ws2.Cells(xx, "b").Text = ws.Cells(x, "c") Then
x1 = x1 + Val(ws.Cells(x, "e"))
x2 = x2 + Val(ws.Cells(x, "g"))
End If
ws2.Cells(xx, "c") = x1 - x2

Next
x1 = 0
x2 = 0
Next
Application.ScreenUpdating = True

End Sub

 

  • Like 1
رابط هذا التعليق
شارك

لا لزوم للكود 

في هذه الحالة  تكفي هذه المعادلة ( في الخلية C2 و تسحب نزولاً)

=SUMPRODUCT((الديون!$C$6:$C$100=$B2)*(الديون!$E$6:$E$100-الديون!$G$6:$G$100))

 

  • Like 2
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information