Listbox

TURKEY

New Member
Joined
Nov 23, 2013
Messages
23
Değerli Kardeşlerim;
Ekli dosyamda yer alan userform1 de kurum adını seçerek, o kuruma ait mahalleleri alt alta kayıt yapıyorum.
Sizlerden ricam ise UserForm2 Ile Ilgili
1 - UserForm2 de ComboBox1 ile ilgili okullarda seçtiğim Kurumların sıralarına göre kuruma ait mahallelerin listesiBox1 de listelenmesi
2 - listBox1 de çiftlerin tasarımı mahalle satiri hangisi icin TextBox2 ye kurumun Adını, TextBox3 icine de mahallenin adının gelmesi,
3 - değiştir butonu ile düzeltilmiş halinin aynı semboleye yazılması ve kaydedilmesi aynı anda listbox1 de görünmesi
4 - Sil butonu ile de verinin kullanımı hücrenin içinin altında kalan diğer mahalle var ise üste doğru taşınması
Benim için önem arz eden bu konular. Yardımını esirgemeyen tüm kardeşlerime teşekkür ederim.

Saygı ve hürmetlerimle


https://drive.google.com/file/d/1gKINs07xIktQRNrtVLuYcehjNrvS3QRx/view?usp=sharing
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Sevgili kardeşim;
İşte UserForm2 için kod

Code:
Private Sub ComboBox1_Change()
    Dim colname As String
    Dim vntList As Variant
    Dim i       As Integer
    Dim le      As String
    
    'For the selected Institution
    TextBox2.Text = ComboBox1.Text
    i = ComboBox1.ListIndex
    le = Mid("cdefghijklmnopqrstuvwxyzaaaaaaaaaaaaaaaaaaaaaaaaa", i + 1, 1)
    colname = le & "2:" & le & Range(le & "65000").End(3).Row
    TextBox3.Text = ""
    ' The selected institution has elements
    If Right(colname, 1) <> "1" Then
        vntList = Sheets("school").Range(colname)
        ListBox1.List = vntList
    Else
        ListBox1.Clear
    End If
End Sub

Private Sub ListBox1_Click()
    Dim Msg As String
    If ListBox1.ListIndex = -1 Then
    Msg = "Nothing"
    Else
        Msg = ""
        For i = 0 To ListBox1.ListCount - 1
            If ListBox1.Selected(i) Then _
              Msg = Msg & ListBox1.List(i) & vbCrLf
        Next i
    End If
    TextBox3.Text = Msg
End Sub


Private Sub UserForm_Initialize()
    ComboBox1.RowSource = "school!a2:a" & [school!a65536].End(3).Row
    
End Sub

İşte kod ile test dosyası
https://1drv.ms/x/s!AovCE1fDrrdSnEiUg9tdNJQQkOLw

Saygı
Sergio
 
Upvote 0
Change line If Right(colname, 1) <> "1" Then
For this line If Right(colname, 2) <> le & "1" Then
Cheers
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top