DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Selamlar,
Çalışmadaki sayfaları Listbox'da listeledim. Listbox'da yapacağım seçime göre o sayfanın verilerini listview'e nasıl alabilirim?
Private Sub ListBox1_Click()
Set Sh = Sheets(ListBox1.List(ListBox1.ListIndex))
With ListView1
.ListItems.Clear
.ColumnHeaders.Clear
.Gridlines = True
.View = lvwReport
.FullRowSelect = True
.LabelEdit = lvwManual
.AllowColumnReorder = True
.Font.Bold = True
End With
With ListView1.ColumnHeaders
For n = 3 To 8
.Add , , Sh.Cells(12, n)
Next
End With
With ListView1
For i = 12 To 32
x = x + 1
.ListItems.Add , , i - 11
If x Mod 2 = 1 Then
.ListItems(x).ForeColor = 255
.ListItems(x).Bold = True
End If
With .ListItems(x).ListSubItems
y = 0
For r = 3 To 8
y = y + 1
.Add , , Sh.Cells(i, r)
If x Mod 2 = 1 Then
ListView1.ListItems(x).ListSubItems(y).ForeColor = 255
ListView1.ListItems(x).ListSubItems(y).Bold = True
End If
Next
End With
Next i
End With
Set Sh = Nothing
End Sub
TextBox8.Text = ListView1.ListItems(x).ListSubItems(7).Text
Private Sub ListBox1_Click()
'On Error Resume Next
TextBox2.SetFocus
Set sh = Sheets(ListBox1.List(ListBox1.ListIndex))
'Sheets(sayfa).Select
Dim i As Integer
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.ColumnHeaders.Clear
ListView1.ListItems.Clear
'Kolanlara isim ver
With ListView1.ColumnHeaders
.Add , , "S.NO ", 30 ' Burda ..... sütun genişliği
.Add , , "ADI", 70
.Add , , "SOYADI", 75
.Add , , "NUMARA", 75
.Add , , "SINIF", 80
.Add , , "ŞUBE", 75
.Add , , "TTTT", 40
.Add , , "UUUU", 50
.Add , , "VVVV", 40
End With
'Kolanlara verileri al
ListView1.SortKey = 0
With ListView1
Application.ScreenUpdating = False
For i = 13 To sh.Cells(Rows.Count, "C").End(3).Row Step 2
x = x + 1
.ListItems.Add , , sh.Cells(i, 3).Value
.ListItems(x).SubItems(1) = sh.Cells(i, 4).Value
.ListItems(x).SubItems(2) = sh.Cells(i + 1, 4).Value
.ListItems(x).SubItems(4) = sh.Cells(i, 5).Value
.ListItems(x).SubItems(3) = sh.Cells(i + 1, 5).Value
.ListItems(x).SubItems(5) = sh.Cells(i, 6).Value
.ListItems(x).SubItems(6) = sh.Cells(i, 7).Value
.ListItems(x).SubItems(7) = sh.Cells(i, 8)
Next
Application.ScreenUpdating = True
End With
ListView1.FullRowSelect = True
ListView1.Gridlines = True
sayı = x
Label1 = sayı & " Adet Kayıt Mevcut."
With Application
End With
'minimize için ikinci kod
End Sub