• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Combobox içeriğini sayfadan çekmek

Katılım
21 Şubat 2013
Mesajlar
33
Excel Vers. ve Dili
Excel 2013 - Eng
Userform ile 3 adet combobox yaptım. Aşağıdaki kod ile 1. combobox'a seçenek listeyelebiliyorum, ancak diğer 2'sine nasıl çekebilirim?

Kod:
Private Sub UserForm_Initialize()

   
    Dim cbtarget As MSForms.ComboBox
    Dim rngSource As Range
    
    'Set reference to the range of data to be filled
    Set rngSource = Worksheets("Sheet1").Range("A1:A15")
    
    'Fill the listbox
    Set cbtarget = Me.ComboBox1
    With cbtarget
        'Insert the range of data supplied
        .List = rngSource.Cells.Value

    End With
    
End Sub
 
Combobox 1 seçildikten sonra ikincisinin içeriğinin doldurulması için şöyle bir kod yazdım, geçici olarak işimi görüyor aslında ama yine de form yüklendiğinde hepsinin dolu olarak gelmesini de öğrensem iyi olur :)

Kod:
Private Sub ComboBox1_Change()
    
    Dim cbtarget2 As MSForms.ComboBox
    Dim rngSource2 As Range
    
    'Set reference to the range of data to be filled
    Set rngSource2 = Worksheets("list").Range("B1:B19")
    
    'Fill the listbox
    Set cbtarget2 = Me.ComboBox2
    With cbtarget2
        'Insert the range of data supplied
        .List = rngSource2.Cells.Value

    End With
    

End Sub
 
Geri
Üst