• DİKKAT

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

Listbox Başa Dön

  • Konbuyu başlatan Konbuyu başlatan yelgecak
  • Başlangıç tarihi Başlangıç tarihi
Katılım
24 Haziran 2006
Mesajlar
95
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

say = ListBox1.ListIndex 'listbox un index numarasını al


If KeyCode = 13 Then 'enter tuşuna basılmışsa

If TextBox1.Text = "" Then 'textbox boş ise
ListBox1.ListIndex = say + 1 'bir aşağı in

Else
Sheets("PAKET").Range("B" & ListBox1.ListIndex + 1).Value = (TextBox1.Text) 'textbox dolu ise hücreye yaz
TextBox1.Text = "" 'taxtboxun içini boşalt
ListBox1.ListIndex = say + 1 'bir aşağı in
End If

End If

End Sub


Yukarıdaki kodlar düzgün bi şekilde çalışıyor ama listbox son satıra gelip entere basınca hata iletisi alıyorum. son satıra gelince 0 index numarasına gitmem için ne yapmam lazım. Yardımlarınızı bekliyorum teşekkürler. Dosya büyük olduğu için ekleyemedim.
 
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

say = ListBox1.ListIndex
doluhücre250 = WorksheetFunction.CountA(Columns("A:A")) - 1 '

If KeyCode = 13 Then
If ListBox1.ListIndex = WorksheetFunction.CountA(Columns("A:A")) - 1 Then
ListBox1.ListIndex = 0
Else


If TextBox1.Text = "" Then
ListBox1.ListIndex = say + 1

Else
Sheets("PAKET").Range("B" & ListBox1.ListIndex + 1).Value = (TextBox1.Text)
TextBox1.Text = ""
ListBox1.ListIndex = say + 1
End If

End If
End If
End Sub

bu şekilde çözdüm
 
Geri
Üst