Skip to main content

AccessTr.neT


Listbox'ta Veri Yokken Hata Veriyor.

Oğuz Türkyılmaz
Oğuz Türkyılmaz
1
195

Listbox'ta Veri Yokken Hata Veriyor.

#2
Başka bir forumdan yardımcı oldular. Sorunum aşağıdaki kodda yazıldığı şekilde çözüldü. Teşekkür ederim.
Kod:
Sub verileriListboxaGetir()
Dim k As Long, adrs As String, j As Byte, m As Long, arrs() As String

sat = ThisWorkbook.Sheets("Personel").Cells(Rows.Count, "A").End(xlUp).Row

Application.ScreenUpdating = False

ReDim arrs(0 To 26, 1 To 1)

ListBoxPersonelListesi.Clear
ListBoxPersonelListesi.ColumnCount = 26
    
k = 1
Do While Not k = sat
m = m + 1

k = k + 1
        ReDim Preserve arrs(0 To 26, 1 To m)
        For j = 0 To 26
            arrs(j, m) = ThisWorkbook.Sheets("Personel").Cells(k, j + 1).Value
                If j = 4 Or j = 5 Then
                    arrs(j, m) = Format(ThisWorkbook.Sheets("Personel").Cells(k, j + 1).Value, "(###) ###-## ##")
                End If
        Next j

Loop

If k > 1 Then
ListBoxPersonelListesi.Column = arrs
End If
On Error Resume Next

Dim x  As String
With ListBoxPersonelListesi

'        For i = 0 To 26
'            deg = deg & CLng(Columns(i + 1).Width) & ";"
'        Next i
'        .ColumnWidths = deg
    
        For i = 0 To 26

            x = x & "70,"
            .ColumnWidths = x

        Next i
'          x = x & "65,"
End With

Application.ScreenUpdating = True
Label_Bilgi.Caption = "Bulunan Kayıt Sayısı :    " & ListBoxPersonelListesi.ListCount

End Sub

Access Çekirgesi 
[Resim: img-cray.gif]


Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
RE: Listbox'ta Veri Yokken Hata Veriyor. - Yazar: Oğuz Türkyılmaz - 07/11/2022, 22:41
Task