Listbox

TURKEY

New Member
Joined
Nov 23, 2013
Messages
10
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:

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

sergioMabres

Well-known Member
Joined
Feb 24, 2013
Messages
946
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
 

sergioMabres

Well-known Member
Joined
Feb 24, 2013
Messages
946
Change line If Right(colname, 1) <> "1" Then
For this line If Right(colname, 2) <> le & "1" Then
Cheers
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,102,758
Messages
5,488,675
Members
407,651
Latest member
Halosty

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top