Ahmet ÖZGÜR
Altın Üye
- Katılım
- 8 Haziran 2010
- Mesajlar
- 349
- Excel Vers. ve Dili
- Office 2003 TR Office 2007 Office 2010
Merhaba aşağıdali kod da bir bölüm var a stünunu aşagıdan yukarı seçiyor.
Örnek: a15 dediğimde a15 ila a1 arasını tamamen seçmekte burada ben istediğim aralıgı seçmek istiyorum nasıl bir değişiklik yapmalıyım.
Örnek: a15 dediğimde a15 ila a1 arasını tamamen seçmekte burada ben istediğim aralıgı seçmek istiyorum nasıl bir değişiklik yapmalıyım.
Kod:
Private a As Long
Dim i As Long
Private Sub ComboBox1_Change()
'listboxa verileri form açılırken rowsource ile aldıysanız
ListBox1.RowSource = ""
'listboxa verileri additem ile aldıysanız
'ListBox1.Clear
For i = 2 To a
If WorksheetFunction.CountIf(Range("A10:A23" & i), Cells(i, "A")) = 1 Then
If ComboBox1.Text = Cells(i, 1) Then
With ListBox1
.AddItem Cells(i, 1)
.List(.ListCount - 1, 1) = Cells(i, 2)
.List(.ListCount - 1, 2) = Cells(i, 3)
.List(.ListCount - 1, 3) = Cells(i, 4)
.List(.ListCount - 1, 4) = Cells(i, 5)
.List(.ListCount - 1, 5) = Cells(i, 6)
.List(.ListCount - 1, 6) = Cells(i, 7)
.List(.ListCount - 1, 7) = Cells(i, 8)
End With
End If
End If
Next i
End Sub
Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 8
ListBox1.RowSource = "Rapor!a10:k23"
[COLOR="Red"]a = Range("a23").Row
For i = 2 To a[/COLOR]
ComboBox1.AddItem Cells(i, 1)
Next i
End Sub
