• DİKKAT

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

userformda 31 tane textbox var ama calıstırınca 21.textboxdan sonra hata veriyo sadece 20 ye kadar calısıyor neden acabaa ?

Katılım
16 Mayıs 2020
Mesajlar
327
Excel Vers. ve Dili
Office 365 Türkçe
Private Sub ListBox1_Click()
If Not ListBox1.ListIndex = -1 Then
TextBox1.Value = ListBox1.List(ListBox1.ListIndex, 1)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox2.Value = ListBox1.List(ListBox1.ListIndex, 2)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox3.Value = ListBox1.List(ListBox1.ListIndex, 3)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox4.Value = ListBox1.List(ListBox1.ListIndex, 4)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox5.Value = ListBox1.List(ListBox1.ListIndex, 5)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox6.Value = ListBox1.List(ListBox1.ListIndex, 6)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox7.Value = ListBox1.List(ListBox1.ListIndex, 7)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox8.Value = ListBox1.List(ListBox1.ListIndex, 8)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox9.Value = ListBox1.List(ListBox1.ListIndex, 9)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox10.Value = ListBox1.List(ListBox1.ListIndex, 10)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox11.Value = ListBox1.List(ListBox1.ListIndex, 11)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox12.Value = ListBox1.List(ListBox1.ListIndex, 12)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox13.Value = ListBox1.List(ListBox1.ListIndex, 13)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox14.Value = ListBox1.List(ListBox1.ListIndex, 14)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox15.Value = ListBox1.List(ListBox1.ListIndex, 15)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox16.Value = ListBox1.List(ListBox1.ListIndex, 16)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox17.Value = ListBox1.List(ListBox1.ListIndex, 17)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox18.Value = ListBox1.List(ListBox1.ListIndex, 18)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox19.Value = ListBox1.List(ListBox1.ListIndex, 19)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox20.Value = ListBox1.List(ListBox1.ListIndex, 20)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox21.Value = ListBox1.List(ListBox1.ListIndex, 21)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox22.Value = ListBox1.List(ListBox1.ListIndex, 22)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox23.Value = ListBox1.List(ListBox1.ListIndex, 23)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox24.Value = ListBox1.List(ListBox1.ListIndex, 24)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox25.Value = ListBox1.List(ListBox1.ListIndex, 25)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox26.Value = ListBox1.List(ListBox1.ListIndex, 26)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox27.Value = ListBox1.List(ListBox1.ListIndex, 27)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox28.Value = ListBox1.List(ListBox1.ListIndex, 28)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox29.Value = ListBox1.List(ListBox1.ListIndex, 29)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox30.Value = ListBox1.List(ListBox1.ListIndex, 30)
End If
If Not ListBox1.ListIndex = -1 Then
TextBox31.Value = ListBox1.List(ListBox1.ListIndex, 31)
End If
End Sub


userformda 31 tane textbox var ama calıstırınca 21.textboxdan sonra hata veriyo sadece 20 ye kadar calısıyor neden acabaa ?
 
.

Hata aldığınız dosyanın örneği ile görmek daha iyi olur.

.
 
ListBox Kolon sayınız doğru mu?
 
C++:
Private Sub UserForm_Initialize()
ListBox1.RowSource = "10_Günlük_Rapor!A5:U32"
ComboBox1.RowSource = "10_Günlük_Rapor!A5:U32"
ComboBox1.ColumnCount = 1
ListBox1.ColumnCount = 1
Kodlarınız böyle başlıyor. RowSource kısmında A-U sütunlarında işlem yapıyor ancak combobox ve listbox kolon sayısını 1 diyorsunuz. Sanki 21 olmalı.
 
C++:
Private Sub UserForm_Initialize()
ListBox1.RowSource = "10_Günlük_Rapor!A5:U32"
ComboBox1.RowSource = "10_Günlük_Rapor!A5:U32"
ComboBox1.ColumnCount = 1
ListBox1.ColumnCount = 1
Kodlarınız böyle başlıyor. RowSource kısmında A-U sütunlarında işlem yapıyor ancak combobox ve listbox kolon sayısını 1 diyorsunuz. Sanki 21 olmalı.
Öle deneyim birde
 
1. ListBox Satır ve Sütun sayıları SIFIRDAN başlar
2. Siz RowSource ile 21 sütun alıyorsunuz. Haliyle 0 dan başlayınca 20.kolona denk gelir.
3. O textBoxdan sonra bir sonraki de hata verecektir.
4. TextBox sayınız ListBox kolon sayısıyla (sıfıra dikkat) aynı olmalı
 
1. ListBox Satır ve Sütun sayıları SIFIRDAN başlar
2. Siz RowSource ile 21 sütun alıyorsunuz. Haliyle 0 dan başlayınca 20.kolona denk gelir.
3. O textBoxdan sonra bir sonraki de hata verecektir.
4. TextBox sayınız ListBox kolon sayısıyla (sıfıra dikkat) aynı olmalı
Yapamadım
 
Listbox Click kodunuzu aşağıdakiyle değiştirin
C++:
Private Sub ListBox1_Click()
If Not ListBox1.ListIndex = -1 Then
    For i = 1 To 31
        Controls("TextBox" & i).Value = ListBox1.List(ListBox1.ListIndex, i - 1)
    Next i
End If

Initialize kodunuzun da baş kısmını değiştirin
C++:
Private Sub UserForm_Initialize()
ListBox1.RowSource = "10_Günlük_Rapor!A5:AF32"

Label1.Caption = Format(Now - 15, "dddd d mmmm yyyy hh:mm:ss ")
' Label1 den itibaren aşağısı aynı kalsın'
 
Listbox Click kodunuzu aşağıdakiyle değiştirin
C++:
Private Sub ListBox1_Click()
If Not ListBox1.ListIndex = -1 Then
    For i = 1 To 31
        Controls("TextBox" & i).Value = ListBox1.List(ListBox1.ListIndex, i - 1)
    Next i
End If

Initialize kodunuzun da baş kısmını değiştirin
C++:
Private Sub UserForm_Initialize()
ListBox1.RowSource = "10_Günlük_Rapor!A5:AF32"

Label1.Caption = Format(Now - 15, "dddd d mmmm yyyy hh:mm:ss ")
' Label1 den itibaren aşağısı aynı kalsın'
çok güzel oldu çok çok tşk ederim sağolun :)
 
Geri
Üst