ListBox'ta boş satırlar görünmesin.

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Mrb
Kod:
Private Sub UserForm_Initialize()
    satirsay = [a65536].End(3).Row
    MsgBox satirsay
    ReDim MyArr(1 To satirsay - 2, 1 To 4)
    Dim i As Long
    ListBox1.ColumnCount = 4
        For i = 3 To satirsay
if cells(i,8)="Sezar" then
            MyArr(i - 2, 1) = Cells(i, 1)
            MyArr(i - 2, 2) = Cells(i, 2)
            MyArr(i - 2, 3) = Cells(i, 3)
            MyArr(i - 2, 4) = Cells(i, 8)
end if
        Next
    ListBox1.List = MyArr
End Sub
Yukarıdaki kodlar ile 8.nci sutunda "Sezar" Olan satırları Listeliyorum.
Fakat Sezar Olmayan satırlar ListBox'ta boş görünüyor.
ListBox'ta Boş satırların görünmemesini istiyorum.
Teşekkür ederim.
İyi çalışmalar.
:hey:
 
Katılım
7 Temmuz 2004
Mesajlar
1,141
[vb:1:fe330b9bb0]Private Sub UserForm_Initialize()
satirsay = [a65536].End(3).Row
MsgBox satirsay
ReDim MyArr(1 To satirsay - 2, 1 To 4)
Dim i As Long
ListBox1.ColumnCount = 4
x = 1
For i = 3 To satirsay
if cells(i,8)="Sezar" then
MyArr(x, 1) = Cells(i, 1)
MyArr(x, 2) = Cells(i, 2)
MyArr(x, 3) = Cells(i, 3)
MyArr(x, 4) = Cells(i, 8)
x = x + 1
end if
Next
ListBox1.List = MyArr
End Sub[/vb:1:fe330b9bb0]
 

Haluk

Özel Üye
Katılım
7 Temmuz 2004
Mesajlar
12,406
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Ufak bir balans ayarı yapılmış şekli;

[vb:1:fe9a17cb2a]Private Sub UserForm_Initialize()
Dim i As Long
Dim MyArr() As Variant
satirsay = [a65536].End(3).Row
ListBox1.ColumnCount = 4
For i = 3 To satirsay
If Cells(i, 8) = "Sezar" Then
x = x + 1
ReDim Preserve MyArr(1 To 4, 1 To x)
MyArr(1, x) = Cells(i, 1)
MyArr(2, x) = Cells(i, 2)
MyArr(3, x) = Cells(i, 3)
MyArr(4, x) = Cells(i, 8)
End If
Next
ListBox1.List = WorksheetFunction.Transpose(MyArr)
End Sub
[/vb:1:fe9a17cb2a]
 

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,254
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Mrb.
Alpen ve Raider arkadaşlarıma ve ilgilenen diğer arkadaşlarıma
Teşekkür ederim.
iyi çalışmalar.
:hey:
 
Üst