• DİKKAT

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

Kodda nerde hata yapıyorum?

Hakan ERDOST

Destek Ekibi
Destek Ekibi
Katılım
12 Eylül 2004
Mesajlar
885
Excel Vers. ve Dili
Excel 2019 Türkçe (Ev)
Excel 2013 Türkçe (Okul)
Kod:
Private Sub CommandButton4_Click()
Set S1 = Sheets("devam_kisi_rapor")
Sheets("devam_kisi_rapor").[A2:D47].ClearContents
For sat = 1 To ListBox2.ListCount - 1
Sheets("devam_kisi_rapor").Cells(sat, "A") = sat - 1
For sut = 1 To 5

Sheets("devam_kisi_rapor").Cells(sat + 1, sut) = ListBox2.List(sat, sut - 2)
Next: Next
S1.Range("B48").Value = ComboBox1.Text
S1.Range("B1").Value = TextBox1.Text & "-" & TextBox2.Text & "TARİHLERİ ARASI DEVAMSIZLIK DURUMU"
S1.Range("B49").Value = ListBox1.List(ListBox1.ListIndex, 3)
S1.Range("B50").Value = ListBox1.List(ListBox1.ListIndex, 2)
MsgBox "İşlem Tamam", vbInformation + vbMsgBoxRtlReading, "hakaNErdost"
End Sub
Kodu ile listbox2 verilerini sayfaya aktarıyorum ancak listboxun 2.satırından itibaren veri aktarıyor. Oysa ilk satırda da veri mevcut. Nerde hata yapıyorum?
 
Kod:
ListBox2.List(sat, sut - 2)

ilgili yeri aşağıdaki gibi değiştirip denermisiniz.

Kod:
ListBox2.List(sat-1, sut - 2)
Maalesef Emre bey aynı şekilde eksik ilk satır ve -1 ile son satır sıra nodan 1 çıkararak işlem yapıyor.
 
Maalesef Emre bey aynı şekilde eksik ilk satır ve -1 ile son satır sıra nodan 1 çıkararak işlem yapıyor.

Şu şekilde dener misiniz ? yine olmaz ise dosyanızı ekleyin birde orada bakalım.
Kod:
Private Sub CommandButton4_Click()
Set S1 = Sheets("devam_kisi_rapor")
Sheets("devam_kisi_rapor").[A2:D47].ClearContents
For sat = 1 To ListBox2.ListCount
Sheets("devam_kisi_rapor").Cells(sat + 1, "A") = sat
For sut = 2 To 5
Sheets("devam_kisi_rapor").Cells(sat + 1, sut) = ListBox2.List(sat - 1, sut - 2)
Next: Next
S1.Range("B48").Value = ComboBox1.Text
S1.Range("B1").Value = TextBox1.Text & "-" & TextBox2.Text & "TARİHLERİ ARASI DEVAMSIZLIK DURUMU"
S1.Range("B49").Value = ListBox1.List(ListBox1.ListIndex, 3)
S1.Range("B50").Value = ListBox1.List(ListBox1.ListIndex, 2)
MsgBox "İşlem Tamam", vbInformation + vbMsgBoxRtlReading, "hakaNErdost"
End Sub
 
Şu şekilde dener misiniz ? yine olmaz ise dosyanızı ekleyin birde orada bakalım.
Kod:
Private Sub CommandButton4_Click()
Set S1 = Sheets("devam_kisi_rapor")
Sheets("devam_kisi_rapor").[A2:D47].ClearContents
For sat = 1 To ListBox2.ListCount
Sheets("devam_kisi_rapor").Cells(sat + 1, "A") = sat
For sut = 2 To 5
Sheets("devam_kisi_rapor").Cells(sat + 1, sut) = ListBox2.List(sat - 1, sut - 2)
Next: Next
S1.Range("B48").Value = ComboBox1.Text
S1.Range("B1").Value = TextBox1.Text & "-" & TextBox2.Text & "TARİHLERİ ARASI DEVAMSIZLIK DURUMU"
S1.Range("B49").Value = ListBox1.List(ListBox1.ListIndex, 3)
S1.Range("B50").Value = ListBox1.List(ListBox1.ListIndex, 2)
MsgBox "İşlem Tamam", vbInformation + vbMsgBoxRtlReading, "hakaNErdost"
End Sub
Şeytan ayrıntıda gizlidir.Teşekkürler, Emre bey.
 
Merhaba kodu dener misiniz?
Kod:
For sat = 0 To ListBox2.ListCount - 1
 
Geri
Üst