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.
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.
