Skip to main content

AccessTr.neT


Excel İstediğimiz Sayfanın İstediğimiz Sutundan Sıralı Filtreli Gruplanmış Liste

Excel İstediğimiz Sayfanın İstediğimiz Sutundan Sıralı Filtreli Gruplanmış Liste

#31
Attaki örneği inceleyebilirsiniz ado ve arraylist sıralama adoda resimdeki gibi garip sıralanıyor buyüzden ado ve bubblesortu beraber kullanıyorum orjinal dosyamda.


https://dosya.co/zozysol1c4xb/Arraylist_...e.rar.html

[Resim: bhc4gcwf.jpg]


[Resim: eg5w9s86.jpg]
Private Sub Ado_Click() 'Ado

Dim rs As Object
Dim con As Object
Dim Sql As String, sql1 As String


Set con = CreateObject("Adodb.Connection")
Set rs = CreateObject("Adodb.Recordset")

ComboBox1.Clear
ListBox2.Clear

con.Open "provider=microsoft.ace.oledb.12.0;data source=" & ThisWorkbook.FullName & ";" & _
                                            "extended properties=""Excel 12.0;hdr=no;Imex=1"""


    Sql = "select f1+0 from [Sayfa1$] where not isnull(f1) group by f1 order by f1 "
    rs.Open sql, con
    ComboBox1.Column = rs.GetRows
    rs.Close
   
     
      rs.Open sql, con
      ListBox2.Column = rs.GetRows
      rs.Close

con.Close: i = Empty: Sql = vbNullString: Set con = Nothing: Set rs = Nothing

End Sub

CommandButton2_Click() 'Arraylist


    Dim arr1 As Object
    Dim sayyfa As Worksheet
    Dim son As Long
   
   
    Set arr1 = CreateObject("System.collections.arraylist")
    Set sayyfa = sayfa
   
    son = sayyfa.Cells(Rows.Count, 1).End(3).Row
    aa = sayyfa.Range("A1:A" & son).Value
   
    Application.ScreenUpdating = False
   
    sayfa.ComboBox1.Clear
    sayfa.ComboBox1.Value = ""
    sayfa.ListBox1.Clear
    With arr1
        For i = 1 To son
            If Not .contains(aa(i, 1) + 0) Then
                arr1.Add aa(i, 1) + 0
            End If
        Next
'  On Error Resume Next
        arr1.Sort
  Err.Clear
        sayfa.ComboBox1.List = arr1.toarray
        sayfa.ListBox1.List = arr1.toarray
        arr1.Clear
        Application.ScreenUpdating = True
       
    End With
   
   
  Set arr1 = Nothing: Erase aa: Set sayyfa = Nothing

End Sub
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Cvp: Excel İstediğimiz Sayfanın İstediğimiz Sutundan Sıralı Filtreli Gruplanmış Liste - Yazar: feraz - 18/01/2020, 14:12
Task