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

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

قام بنشر

اخى نايف

جرب الكود التالى

لفرز عمود التاريخ

Private Sub CommandButton3_Click()
Dim i As Long
    Dim j As Long
    Dim sTemp As String
    Dim sTemp2 As String
    Dim sTemp3 As String
    Dim sTemp4 As String
    Dim sTemp5 As String
    Dim sTemp6 As String
        Dim sTemp7 As String
            Dim sTemp8 As String
    Dim LbList As Variant
'
    LbList = Me.ListBox1.List
    For i = LBound(LbList, 1) To UBound(LbList, 1)
        For j = i + 1 To UBound(LbList, 1)
            '--------------------------------------------------------------------
    ' ÇáÊÑÊíÈ ÈäÇÁ Úáì ÇáÚãæÏ ÇáËÇäì

            If LbList(i, 6) > LbList(j, 6) Then
 
                sTemp = LbList(i, 0)
                LbList(i, 0) = LbList(j, 0)
                LbList(j, 0) = sTemp
 
                sTemp2 = LbList(i, 1)
                LbList(i, 1) = LbList(j, 1)
                LbList(j, 1) = sTemp2
 
                 sTemp3 = LbList(i, 2)
                LbList(i, 2) = LbList(j, 2)
                LbList(j, 2) = sTemp3

                  sTemp4 = LbList(i, 3)
                LbList(i, 3) = LbList(j, 3)
                LbList(j, 3) = sTemp4
                
                 sTemp5 = LbList(i, 4)
                LbList(i, 4) = LbList(j, 4)
                LbList(j, 4) = sTemp5
                
                 sTemp6 = LbList(i, 5)
                LbList(i, 5) = LbList(j, 5)
                LbList(j, 5) = sTemp6
                
                 sTemp7 = LbList(i, 6)
                LbList(i, 6) = LbList(j, 6)
                LbList(j, 6) = sTemp7

                 sTemp8 = LbList(i, 7)
                LbList(i, 7) = LbList(j, 7)
                LbList(j, 7) = sTemp8


            End If
        Next j
    Next i
 
    Me.ListBox1.Clear
 
    Me.ListBox1.List = LbList
 End Sub

وجرب الكود التالى

لفرز عمود الاسماء

Private Sub CommandButton2_Click()
Dim i As Long
    Dim j As Long
    Dim sTemp As String
    Dim sTemp2 As String
    Dim sTemp3 As String
    Dim sTemp4 As String
    Dim sTemp5 As String
    Dim sTemp6 As String
        Dim sTemp7 As String
            Dim sTemp8 As String
    Dim LbList As Variant
'
    LbList = Me.ListBox1.List
    For i = LBound(LbList, 1) To UBound(LbList, 1)
        For j = i + 1 To UBound(LbList, 1)
            '--------------------------------------------------------------------
    ' ÇáÊÑÊíÈ ÈäÇÁ Úáì ÇáÚãæÏ ÇáËÇäì

            If LbList(i,1) > LbList(j, 1) Then
 
                sTemp = LbList(i, 0)
                LbList(i, 0) = LbList(j, 0)
                LbList(j, 0) = sTemp
 
                sTemp2 = LbList(i, 1)
                LbList(i, 1) = LbList(j, 1)
                LbList(j, 1) = sTemp2
 
                 sTemp3 = LbList(i, 2)
                LbList(i, 2) = LbList(j, 2)
                LbList(j, 2) = sTemp3

                  sTemp4 = LbList(i, 3)
                LbList(i, 3) = LbList(j, 3)
                LbList(j, 3) = sTemp4
                
                 sTemp5 = LbList(i, 4)
                LbList(i, 4) = LbList(j, 4)
                LbList(j, 4) = sTemp5
                
                 sTemp6 = LbList(i, 5)
                LbList(i, 5) = LbList(j, 5)
                LbList(j, 5) = sTemp6
                
                 sTemp7 = LbList(i, 6)
                LbList(i, 6) = LbList(j, 6)
                LbList(j, 6) = sTemp7

                 sTemp8 = LbList(i, 7)
                LbList(i, 7) = LbList(j, 7)
                LbList(j, 7) = sTemp8


            End If
        Next j
    Next i
 
    Me.ListBox1.Clear
 
    Me.ListBox1.List = LbList
 End Sub

تقبل تحياتى

  • 1 year later...
قام بنشر

أخي الكريم تمت مشاركة الأخ إبراهيم ابو ليلة بكود وقد أخبرت أنه المطلوب ..بعدها طلبت طلب آخر

إذا كان الطلب غير مرتبط بالموضوع فمن الأفضل ان تطرح موضوع جديد حيث أن الطلبات في المشاركات الفرعية لا يلتفت إليها في غالب الأحيان

تقبل نصيحتي وتوجيهي

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