userform tarih

Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Arkadaşlar merhaba.
Userformda bul tuşuyla textboxa a sütununundaki veriyi alıyorum. Benim istediğim 2009 yılı girdiğinde b sütunundan 2010 yılı girdiğinde c sütunundan veri alsın nasıl yapabilriz.
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,738
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Selamlar,

Kullandığınız kodu buraya eklerseniz yada örnek dosya eklerseniz yardımcı olabiliriz.
 
Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Private Sub CommandButton1_Click()
Set bul = Range("a1:a65536").Find(TextBox3, lookat:=xlWhole)
If Not bul Is Nothing Then
TextBox4 = Cells(bul.Row, "b")
TextBox5 = Cells(bul.Row, "c")
ComboBox1 = Cells(bul.Row, "d")
Label6 = Cells(bul.Row, "e")
Else
MsgBox "aradığınız kayıt bulunamadı."
End If
End Sub


Kod bu şekilde. Label6 e sütunundan veri alıyor. 2009 da f sütunundan 2010 da g sütunundan veri almasını istiyorum.
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,738
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Selamlar,

Kullandığınız kodu aşağıdaki şekilde değiştirip denermisiniz.

Kod:
Private Sub CommandButton1_Click()
    Dim Bul As Range
    Set Bul = Columns(1).Find(TextBox3, LookAt:=xlWhole)
        If Not Bul Is Nothing Then
            TextBox4 = Cells(Bul.Row, "B")
            TextBox5 = Cells(Bul.Row, "C")
            ComboBox1 = Cells(Bul.Row, "D")
            
            If Year(TextBox3) = "2008" Then
                Label6 = Cells(Bul.Row, "E")
            ElseIf Year(TextBox3) = "2009" Then
                Label6 = Cells(Bul.Row, "F")
            ElseIf Year(TextBox3) = "2010" Then
                Label6 = Cells(Bul.Row, "G")
            End If
        Else
            MsgBox "Aradığınız kayıt bulunamadı !", vbCritical
        End If
End Sub
 
Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Teşekkürler
 
Son düzenleme:
Üst