- Katılım
- 30 Aralık 2008
- Mesajlar
- 9
- Excel Vers. ve Dili
- excel2003 türkçe
Merhaba arkadaşlar
Aşağıdaki kodda görüldüğü üzere additem ile oluşturulmuş listboxlardan rapor sayfasına verileri taşımak istiyorum fakat 16. sütündan ileriye veri aktaramıyorum.
Yardımcı olursanız müteşekkür olurum.
Saygılarımla.
Mehmet Özgür
Aşağıdaki kodda görüldüğü üzere additem ile oluşturulmuş listboxlardan rapor sayfasına verileri taşımak istiyorum fakat 16. sütündan ileriye veri aktaramıyorum.
Yardımcı olursanız müteşekkür olurum.
Saygılarımla.
Mehmet Özgür
Kod:
Private Sub CommandButton2_Click()
Dim i As Integer
Dim j As Integer
Dim satir As Integer
Dim rapor As Worksheet
Dim kontrol As Boolean
kontrol = False
'1##################
For i = 0 To lstRapor.ListCount - 1
If lstRapor.Selected(i) = True Then
kontrol = True
Exit For
End If
Next i
Set rapor = Worksheets("RAPOR")
rapor.Cells.Clear
For i = 1 To 8
rapor.Cells(1, i).Value = lstBaslik.Column(i - 1, 0)
Next i
rapor.Range("a1:aw1").Font.Bold = True
satir = 2
If kontrol = False Then
rapor.Range(rapor.Cells(2, 1), rapor.Cells(lstRapor.ListCount + 1, lstRapor.ColumnCount)) = lstRapor.List
Else
For i = 0 To lstRapor.ListCount - 1
If lstRapor.Selected(i) = True Then
For j = 0 To lstRapor.ColumnCount - 1
rapor.Cells(satir, j + 1) = lstRapor.List(i, j)
Next j
satir = satir + 1
End If
'2################################
Next i
End If
kontrol = False
For i = 0 To lstRapor1.ListCount - 1
If lstRapor1.Selected(i) = True Then
kontrol = True
Exit For
End If
Next i
Set rapor = Worksheets("RAPOR")
For i = 9 To 16
rapor.Cells(1, i).Value = lstBaslik1.Column(i - 9, 0)
Next i
rapor.Range("a1:aw1").Font.Bold = True
satir = 2
If kontrol = False Then
rapor.Range(rapor.Cells(2, 16), rapor.Cells(lstRapor1.ListCount + 1, lstRapor1.ColumnCount)) = lstRapor1.List
Else
For i = 0 To lstRapor1.ListCount - 1
If lstRapor1.Selected(i) = True Then
For j = 0 To lstRapor1.ColumnCount - 1
rapor.Cells(satir, j + 1) = lstRapor1.List(i, j)
Next j
satir = satir + 1
End If
'3################################
Next i
End If
kontrol = False
For i = 0 To lstRapor2.ListCount - 1
If lstRapor2.Selected(i) = True Then
kontrol = True
Exit For
End If
Next i
Set rapor = Worksheets("RAPOR")
For i = 17 To 24
rapor.Cells(1, i).Value = lstBaslik2.Column(i - 17, 0)
Next i
satir = 2
If kontrol = False Then
rapor.Range(rapor.Cells(2, 24), rapor.Cells(lstRapor2.ListCount + 1, lstRapor2.ColumnCount)) = lstRapor2.List
Next i
Else
For i = 0 To lstRapor2.ListCount - 1
If lstRapor2.Selected(i) = True Then
For j = 0 To lstRapor2.ColumnCount - 1
rapor.Cells(satir, j + 1) = lstRapor2.List(i, j)
Next j
satir = satir + 1
End If
Next i
End If
End Sub
