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

تصفيه بالكود وبشروط


inas aly

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

درس عباره عن تصفيه بالكود وبشروط – الصوره توضح

السلام عليكم اخوانى واخواتى الكرام

حبيت اشاركم درس خفيف لقيته بالصدفه منقول للامانه رابط

1-300x228.png

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Public Type product
    name As String
    pages As String
End Type
 
Sub GroupProducts()
Dim products() As product
Dim lastRow, i, j, n As Long
ReDim products(1 To 1)
 
lastRow = Range(“a1”).End(xlDown).Row
 
For i = 2 To lastRow
    found = False
    For j = LBound(products) To UBound(products)
        If Cells(i, 1).Value = products(j).name Then
            found = True
            products(j).pages = products(j).pages & “, “ & Cells(i, 2).Value
        End If
    Next j
    
    If found = False Then
        n = n + 1
        ReDim Preserve products(1 To n)
        products(n).name = Cells(i, 1).Value
        products(n).pages = Cells(i, 2).Value
    End If
    
    Cells(i, 1).Value = “”
    Cells(i, 2).Value = “”
Next i
 
For i = LBound(products) To UBound(products)
    Cells(i + 1, 1).Value = products(i).name
    Cells(i + 1, 2).Value = products(i).pages
Next i
 
End Sub

منقول

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

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