Ara butonunda kod hatası

Katılım
7 Mart 2007
Mesajlar
60
Excel Vers. ve Dili
Excel 2003 almanca
Saygilar arama butonuna atadigim kodlar D sutununu gormuyor C den basliyor
acaba nerde hata yapiyorum

HTML:
Private Sub CommandButton1_Click()
With Sheets("Tabelle1")
 
 Set zelle = .Columns("C:C").Find(TextBox2.Value, LookIn:=xlValues)
 If Not zelle Is Nothing Then
   lngZeile = zelle.Row
     TextBox1.Value = .Cells(zelle.Row, 1).Value
     TextBox2.Value = .Cells(zelle.Row, 2).Value
     TextBox3.Value = .Cells(zelle.Row, 3).Value
     TextBox4.Value = .Cells(zelle.Row, 4).Value
     TextBox5.Value = .Cells(zelle.Row, 5).Value
     TextBox6.Value = .Cells(zelle.Row, 6).Value
     TextBox7.Value = .Cells(zelle.Row, 7).Value
     
  Else
  MsgBox "Den Nachname" & TextBox2.Value & " gibt es nicht!"
 End If
End With

End Sub
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,248
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Aşağıdaki satırı değiştirerek deneyiniz.:cool:
Kod:
Set zelle = .Columns("[B][COLOR="Red"]D:D[/COLOR][/B]").Find(TextBox2.Value, LookIn:=xlValues)
 
Katılım
7 Mart 2007
Mesajlar
60
Excel Vers. ve Dili
Excel 2003 almanca
Saygilar Evren bey denedim olmuyor C deki isme gore aradigi icin C:C yaptim
 
Katılım
7 Mart 2007
Mesajlar
60
Excel Vers. ve Dili
Excel 2003 almanca
Saygilar Bu konuda fikri olan yokmu yada altarnatif ayni sekilde baska kod duzeni ola bilirmi
 

Korhan Ayhan

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

Kodunuzdaki problem sütun index numaralarında. Kırmızı renkli bölümleri 1 arttırarak yazdığınızda düzelecektir.

Kod:
TextBox1.Value = .Cells(zelle.Row, [B][COLOR=red]1[/COLOR][/B]).Value
Ayrıca kodunuzda "lngZeile = zelle.Row" şeklinde bir tanımlama oluşturmuşsunuz fakat hiçbir yerde kullanmamışsınız.


Hatırlatma: Eğer tablonuzda aynı isimden birden fazla kayıt varsa kullandığınız kod ilk bulduğu satırı forma yükleyecektir.
 
Katılım
7 Mart 2007
Mesajlar
60
Excel Vers. ve Dili
Excel 2003 almanca
Saygilar Korhan bey asil dosya biraz buyuk o yuzden ornek yapip sundum

1 artirip yazin burayi anayamadim Biraz acarmisiniz

TextBox1.Value = .Cells(zelle.Row, 1).Value
TextBox2.Value = .Cells(zelle.Row, 2).Value
TextBox3.Value = .Cells(zelle.Row, 3).Value
TextBox4.Value = .Cells(zelle.Row, 4).Value
TextBox5.Value = .Cells(zelle.Row, 5).Value
TextBox6.Value = .Cells(zelle.Row, 6).Value
TextBox7.Value = .Cells(zelle.Row, 7).Value
 

Korhan Ayhan

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

1 yazan yeri 2 yaptıktan sonra alt satırlarıda arttırarak devam edeceksiniz.

Buradaki 1 değeri A sütununu ifade etmektedir. Ama sizin verileriniz B sütunundan başlamaktadır.

Kısaca aşağıdaki şekilde olması gerekir kodlarınızın.

Kod:
TextBox1.Value = .Cells(zelle.Row, [COLOR=red]2[/COLOR]).Value
TextBox2.Value = .Cells(zelle.Row, [COLOR=red]3[/COLOR]).Value
TextBox3.Value = .Cells(zelle.Row, [COLOR=red]4[/COLOR]).Value
TextBox4.Value = .Cells(zelle.Row, [COLOR=red]5[/COLOR]).Value
TextBox5.Value = .Cells(zelle.Row, [COLOR=red]6[/COLOR]).Value
TextBox6.Value = .Cells(zelle.Row, [COLOR=red]7[/COLOR]).Value
TextBox7.Value = .Cells(zelle.Row, [COLOR=red]8[/COLOR]).Value
 
Katılım
7 Mart 2007
Mesajlar
60
Excel Vers. ve Dili
Excel 2003 almanca
Korhan bey Tesekurederim ilgilendiginiz icin

Saygilar
 
Üst