• DİKKAT

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

Combobox1'deki bilgiye göre başka sayfadan textboxlara veri alma

Katılım
29 Aralık 2005
Mesajlar
862
Excel Vers. ve Dili
Office 365 Türkçe
Merhaba arkadaşlar

Döküman güncelleme sayfasında aşağıdaki kodu yazmaya çalıştım. Amacım combobox1'de döküman numarasını seçtiğimde diğer textboxlara "dok listesi" sayfasında kayıtlı ilgili dökümanın diğer bilgilerini getirmekti. Forumdaki örnekler ise eski olduğu için dosyalarını açamadım. Sizden ricam bu konuda bana yardım etmeniz. Kullandığım kodlar aşağıda, dosyayıda ekte gönderiyorum. İlgilenecek arkadaşlara şimdiden teşekkür ederim.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Intersect(Target, s1.ComboBox1) Is Nothing Then Exit Sub
Set s1 = Sheets("Dok Güncelleme")
Set s2 = Sheets("Dok listesi")

With s2.Range("e4:e10000")
Set bul = .Find(s1.ComboBox1.Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not bul Is Nothing Then

s1.TextBox1.Value = s2.Cells(bul.Row, "b")
s1.TextBox2.Value = s2.Cells(bul.Row, "f")
s1.TextBox3.Value = s2.Cells(bul.Row, "c")
s1.TextBox4.Value = s2.Cells(bul.Row, "d")
s1.TextBox5.Value = s2.Cells(bul.Row, "ı")
s1.TextBox6.Value = s2.Cells(bul.Row, "h")
s1.TextBox7.Value = s2.Cells(bul.Row, "g")
s1.TextBox8.Value = s2.Cells(bul.Row, "j")
Else
MsgBox "Aradığınız Kayıt Bulunamadı", vbInformation, "Bilgi"
s1.ComboBox1.Select
End If
End With

Set bul = Nothing
Set s1 = Nothing
Set s2 = Nothing
End Sub
 

Ekli dosyalar

Fazla bir şey yapmaya gerek kalmamış siz halletmişsiniz zaten iyi çalışmalar.

Kod:
Private Sub ComboBox1_Change()
On Error Resume Next
Set s1 = Sheets("Dok Güncelleme")
Set s2 = Sheets("Dok listesi")
    With s2.Range("e4:e10000")
        Set bul = .Find(s1.ComboBox1, LookIn:=xlValues, LookAt:=xlWhole)
            If Not bul Is Nothing Then
                s1.TextBox1.Value = s2.Cells(bul.Row, "b")
                s1.TextBox2.Value = s2.Cells(bul.Row, "f")
                s1.TextBox3.Value = s2.Cells(bul.Row, "c")
                s1.TextBox4.Value = s2.Cells(bul.Row, "d")
                s1.TextBox5.Value = s2.Cells(bul.Row, "ı")
                s1.TextBox6.Value = s2.Cells(bul.Row, "h")
                s1.TextBox7.Value = s2.Cells(bul.Row, "g")
                s1.TextBox8.Value = s2.Cells(bul.Row, "j")
                Else
                MsgBox "Aradığınız Kayıt Bulunamadı", vbInformation, "Bilgi"
                s1.ComboBox1.Select
            End If
    End With
Set bul = Nothing
Set s1 = Nothing
Set s2 = Nothing
End Sub

Private Sub Worksheet_Activate()
ComboBox1.ListFillRange = "Dok listesi!e4:e10000"
End Sub
 
Sayın Fedeal

Cevabınız için çok teşekkür ederim, çalıştı. İşin "püf noktası"nı bilmek bu olsa gerek :)
 
Sayın Fedeal

Cevabınız için çok teşekkür ederim, çalıştı. İşin "püf noktası"nı bilmek bu olsa gerek :)

hayır komutları bilmek siz sayfanın change olayına yazmıştınız ben comboboxun , kod combobox değişince çalışmalıydı. Saygılar.
 
Geri
Üst