DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub cmb()
Dim k As Range, sut As Integer, s1 As Worksheet, s2 As Worksheet, sat As Long
Dim s3 As Worksheet, ilce As String, mahalle As String, sokak As String
Set s1 = Sheets("ilce")
Set s2 = Sheets("mahalle")
Set s3 = Sheets("sokak")
ilce = ComboBox4.Value
mahalle = ComboBox5.Value
sokak = ComboBox6.Value
Set k = s2.Range("A1:IV" & s2.Cells(1, 1).End(xlToLeft).Column).Find(ilce, , xlValues, xlWhole)
If Not k Is Nothing Then
sat = s2.Cells(Rows.Count, k.Column).End(xlUp).Row
ComboBox5.RowSource = "mahalle!" & s2.Range(s2.Cells(2, k.Column), s2.Cells(sat, k.Column)).Address
End If
Set k = Nothing
Set k = s3.Range("A2:A" & Rows.Count).Find(mahalle, , xlValues, xlWhole)
If Not k Is Nothing Then
sat = WorksheetFunction.CountIf(s3.Range("A2:A" & Rows.Count), mahalle) - 1
ComboBox6.RowSource = "sokak!" & s3.Range(s3.Cells(k.Row, 2), s3.Cells(k.Row + sat, 2)).Address
End If
End Sub
Selam
Combobox da İlçe seçilince ilçe adının aynısı mahalle sayfasından bulunup sonrasında bulunan hücrenin kendisi hariç altındaki dolu hücreler diğer ComboBox ın Rowsource olayına çağrılabilirmi.
Option Explicit
Private Sub ComboBox4_Change()
'Konu : Combobox5'e Mahalleleri Yaz
'Mail : m.batu.1967@gmail.com
'Msn : m.batu.1967@hotmail.com.tr
'Skype : m.batu.1967
'Coder By : asi_kral_1967
Dim asi As Worksheet, kral As Long, kolon As String
Set asi = Sheets("mahalle")
kral = WorksheetFunction.Match(ComboBox4, asi.Rows("1:1"), 0)
kolon = Replace(Replace(Cells(1, kral).Address, 1, ""), "$", "")
ComboBox5 = ""
ComboBox5.RowSource = ""
ComboBox5.RowSource = "mahalle!" & kolon & 2 & ":" & kolon & asi.Range(kolon & Rows.Count).End(xlUp).Row
End Sub
Private Sub ComboBox5_Change()
'Konu : Combobox6'e Sokakları Yaz
'Mail : m.batu.1967@gmail.com
'Msn : m.batu.1967@hotmail.com.tr
'Skype : m.batu.1967
'Coder By : asi_kral_1967
Dim asi As Worksheet, kral As Long, kolon As String
Set asi = Sheets("sokak")
If ComboBox5 <> "" Then
kral = WorksheetFunction.Match(ComboBox5, asi.Rows("1:1"), 0)
kolon = Replace(Replace(Cells(1, kral).Address, 1, ""), "$", "")
ComboBox6 = ""
ComboBox6.RowSource = ""
ComboBox6.RowSource = "sokak!" & kolon & 2 & ":" & kolon & asi.Range(kolon & Rows.Count).End(xlUp).Row
End If
End Sub
Private Sub UserForm_Initialize()
'Konu : Combobox4'e İlçeleri Yaz
'Mail : m.batu.1967@gmail.com
'Msn : m.batu.1967@hotmail.com.tr
'Skype : m.batu.1967
'Coder By : asi_kral_1967
Dim asi As Worksheet
Set asi = Sheets("ilce")
ComboBox4.RowSource = "ilce!A2:A" & asi.Range("A" & Rows.Count).End(xlUp).Row
End Sub
Sayın Batu teşekkür ediyorum mükemmel olmuş
Selam ve Dua ile kalın sağlıcakla.
Konuyu okuyan arkadaşlara Not.
(Başka arkadaş kullanırken kafa karıştırmaması için sorunun oluşum ve değerlendirilmesi aşamasındaki örnek dosyaları sildim. Sayfada bulunan kodlar ve örnek dosyalar sadece soruma cevap teşkil eden son şekli verilmiş olan dosyalardır)