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

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

قام بنشر (معدل)

السلام عليكم ورحمة الله 

الاخوة الكرام 

في المرفق اريد كود داخ الفورم يجمع القيم في العمود D حسب الرقم في العمود a  باستثناء الفترة في Label5

ملاحظة: البيانات كثيرة  حبدا الكود يكون مرنا

جزاكم الله خيراSumif.xlsm

تم تعديل بواسطه رشبد
  • أفضل إجابة
قام بنشر (معدل)
Private Sub UserForm_Initialize()
Label5.Caption = [j1]
End Su
'*******************
Private Sub TextBox1_Change()
Dim n As Range, J As Long, f As Long
Set WS = Worksheets("Sheet1")
Cnt = Me.TextBox1.Value: WS.[W1] = Cnt
f = WS.Cells(WS.Rows.Count, 2).End(xlUp).Row
If Cnt <> "" Then
With WS
   Set n = .Range("A2:A" & f).Find(What:=Cnt, LookIn:=xlValues, LookAt:=xlWhole, _
      SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False)
    If Not n Is Nothing Then
      J = n.Row
      Me.TextBox2 = .Range("B" & J)
      Me.TextBox3 = Evaluate("=SUMPRODUCT((D2:D10000) * (A2:A10000=W1) * (C2:C10000<>j1))")
         End If
     End With
  Else
Me.TextBox3 = "": Me.TextBox2 = ""
  End If
End Sub
'OR=============================================================
Public Property Get WS() As Worksheet: Set WS = Worksheets("Sheet1")
End Property
Private Sub UserForm_Initialize()
Set J = CreateObject("Scripting.Dictionary")
  a = WS.Range("A2:A" & WS.[A65000].End(xlUp).Row)
  For i = LBound(a) To UBound(a)
    If a(i, 1) <> "" Then J(a(i, 1)) = ""
  Next i
  n = J.keys
  Me.ComboBox1.List = n
  Label5.Caption = [j1]
End Sub
Private Sub ComboBox1_Change()
Dim n As Range, J As Long, f As Long
Cnt = Me.ComboBox1.Value: WS.[W1] = Cnt
'''Code.....

  Else
Me.TextBox3 = "": Me.TextBox2 = ""
  End If
End Sub

 

 

Sumif v2.xlsm

تم تعديل بواسطه محمد هشام.
  • Like 3

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