Soru combobox ile filtreleme

SATYON

Altın Üye
Katılım
5 Mayıs 2006
Mesajlar
121
Excel Vers. ve Dili
Microsoft Office Excel 2013 / İngilizce
Altın Üyelik Bitiş Tarihi
21-04-2027
merhaba daha önce hiç combobox kullanmadım. ekli linkteki dosyama textbox 4 ve textbox 5 yerine combobox kullanarak Q ve R kolonlarında filtreleme yapmak istiyorum. 2 tane combobox kullanmalıyım. 1.combobox q kolonunda yaptığım seçime göre filtrelenmeli 1. comboboxtaki filtrelemeye göre 2.combobox daha kısıtlı bir filtreleme yapmalı. örneğin combobox 1 de toner filtrelediysem combobox 2 de sadece monton,colton,copıton gelmeli listeye. yardımcı olursanız çok sevinirim. teşekkürler.

 

SATYON

Altın Üye
Katılım
5 Mayıs 2006
Mesajlar
121
Excel Vers. ve Dili
Microsoft Office Excel 2013 / İngilizce
Altın Üyelik Bitiş Tarihi
21-04-2027
merhaba daha önce hiç combobox kullanmadım. ekli linkteki dosyama textbox 4 ve textbox 5 yerine combobox kullanarak Q ve R kolonlarında filtreleme yapmak istiyorum. 2 tane combobox kullanmalıyım. 1.combobox q kolonunda yaptığım seçime göre filtrelenmeli 1. comboboxtaki filtrelemeye göre 2.combobox daha kısıtlı bir filtreleme yapmalı. örneğin combobox 1 de toner filtrelediysem combobox 2 de sadece monton,colton,copıton gelmeli listeye. yardımcı olursanız çok sevinirim. teşekkürler.

hocam biri yardımcı olabilecek mi lütfen
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,191
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Sayfanıza iki adet ComboBox ekleyip deneyiniz.

C++:
Private Sub ComboBox1_Change()
    Dim Baglanti As Object, Kayit_Seti As Object
    
    ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=17
    
    If ComboBox1 <> "" And CheckBox4 = True Then
        Set Baglanti = CreateObject("AdoDb.Connection")
        Set Kayit_Seti = CreateObject("AdoDb.Recordset")
        
        Baglanti.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source=" & ThisWorkbook.FullName & _
        ";Extended Properties=""Excel 12.0;Hdr=Yes"""
        
        Kayit_Seti.Open "Select Distinct F18 From [RAPOR$] Where F17 = '" & ComboBox1.Value & "'", Baglanti, 1, 3
            
        If Kayit_Seti.RecordCount > 0 Then ComboBox2.Column = Kayit_Seti.GetRows
        
        ComboBox2.ListIndex = -1
        
        ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=17, Criteria1:=ComboBox1.Value
        
        Kayit_Seti.Close
        Baglanti.Close
        Set Kayit_Seti = Nothing
        Set Baglanti = Nothing
    End If
End Sub

Private Sub ComboBox1_DropButtonClick()
    Dim Baglanti As Object, Kayit_Seti As Object
    
    Set Baglanti = CreateObject("AdoDb.Connection")
    Set Kayit_Seti = CreateObject("AdoDb.Recordset")
    
    Baglanti.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source=" & ThisWorkbook.FullName & _
    ";Extended Properties=""Excel 12.0;Hdr=Yes"""
    
    Kayit_Seti.Open "Select Distinct F17 From [RAPOR$] Where F17 Is Not Null", Baglanti, 1, 3
        
    If Kayit_Seti.RecordCount > 0 Then ComboBox1.Column = Kayit_Seti.GetRows
    
    Kayit_Seti.Close
    Baglanti.Close
    
    Set Kayit_Seti = Nothing
    Set Baglanti = Nothing
End Sub

Private Sub ComboBox2_Change()
    ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=18
    If ComboBox2 <> "" And CheckBox5 = True Then
        ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=18, Criteria1:=ComboBox2.Value
    End If
End Sub

Private Sub ComboBox2_DropButtonClick()
    Dim Baglanti As Object, Kayit_Seti As Object
    
    If ComboBox1 = "" Then
        Set Baglanti = CreateObject("AdoDb.Connection")
        Set Kayit_Seti = CreateObject("AdoDb.Recordset")
        
        Baglanti.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source=" & ThisWorkbook.FullName & _
        ";Extended Properties=""Excel 12.0;Hdr=Yes"""
        
        Kayit_Seti.Open "Select Distinct F18 From [RAPOR$] Where F18 Is Not Null", Baglanti, 1, 3
            
        If Kayit_Seti.RecordCount > 0 Then ComboBox2.Column = Kayit_Seti.GetRows
        
        Kayit_Seti.Close
        Baglanti.Close
        
        Set Kayit_Seti = Nothing
        Set Baglanti = Nothing
    End If
End Sub
 

SATYON

Altın Üye
Katılım
5 Mayıs 2006
Mesajlar
121
Excel Vers. ve Dili
Microsoft Office Excel 2013 / İngilizce
Altın Üyelik Bitiş Tarihi
21-04-2027
Sayfanıza iki adet ComboBox ekleyip deneyiniz.

C++:
Private Sub ComboBox1_Change()
    Dim Baglanti As Object, Kayit_Seti As Object
   
    ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=17
   
    If ComboBox1 <> "" And CheckBox4 = True Then
        Set Baglanti = CreateObject("AdoDb.Connection")
        Set Kayit_Seti = CreateObject("AdoDb.Recordset")
       
        Baglanti.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source=" & ThisWorkbook.FullName & _
        ";Extended Properties=""Excel 12.0;Hdr=Yes"""
       
        Kayit_Seti.Open "Select Distinct F18 From [RAPOR$] Where F17 = '" & ComboBox1.Value & "'", Baglanti, 1, 3
           
        If Kayit_Seti.RecordCount > 0 Then ComboBox2.Column = Kayit_Seti.GetRows
       
        ComboBox2.ListIndex = -1
       
        ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=17, Criteria1:=ComboBox1.Value
       
        Kayit_Seti.Close
        Baglanti.Close
        Set Kayit_Seti = Nothing
        Set Baglanti = Nothing
    End If
End Sub

Private Sub ComboBox1_DropButtonClick()
    Dim Baglanti As Object, Kayit_Seti As Object
   
    Set Baglanti = CreateObject("AdoDb.Connection")
    Set Kayit_Seti = CreateObject("AdoDb.Recordset")
   
    Baglanti.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source=" & ThisWorkbook.FullName & _
    ";Extended Properties=""Excel 12.0;Hdr=Yes"""
   
    Kayit_Seti.Open "Select Distinct F17 From [RAPOR$] Where F17 Is Not Null", Baglanti, 1, 3
       
    If Kayit_Seti.RecordCount > 0 Then ComboBox1.Column = Kayit_Seti.GetRows
   
    Kayit_Seti.Close
    Baglanti.Close
   
    Set Kayit_Seti = Nothing
    Set Baglanti = Nothing
End Sub

Private Sub ComboBox2_Change()
    ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=18
    If ComboBox2 <> "" And CheckBox5 = True Then
        ActiveSheet.ListObjects("Table_AKSELNETSIS_AK20_AKSEL_STRAPOR_NEW_1").Range.AutoFilter Field:=18, Criteria1:=ComboBox2.Value
    End If
End Sub

Private Sub ComboBox2_DropButtonClick()
    Dim Baglanti As Object, Kayit_Seti As Object
   
    If ComboBox1 = "" Then
        Set Baglanti = CreateObject("AdoDb.Connection")
        Set Kayit_Seti = CreateObject("AdoDb.Recordset")
       
        Baglanti.Open "Provider=Microsoft.ACE.OleDb.12.0;Data Source=" & ThisWorkbook.FullName & _
        ";Extended Properties=""Excel 12.0;Hdr=Yes"""
       
        Kayit_Seti.Open "Select Distinct F18 From [RAPOR$] Where F18 Is Not Null", Baglanti, 1, 3
           
        If Kayit_Seti.RecordCount > 0 Then ComboBox2.Column = Kayit_Seti.GetRows
       
        Kayit_Seti.Close
        Baglanti.Close
       
        Set Kayit_Seti = Nothing
        Set Baglanti = Nothing
    End If
End Sub
oldu. çok teşekkür ederim.
 
Üst