Aşağıdaki TextBox1_Change bağlı arama kutusunda arama işleminden sonra textbox1 deki yazdığım veriyi silerken çok yavaşlama olmakta ve textbox1 e bağlı listviewe veriler çok geç gelmektedir.Bunu hızlandırmanın bir yolu varmidır acaba.
Private Sub TextBox1_Change() 'ARAMA TEXT KUTUSU
ListView1.ListItems.Clear
ListView1.ColumnHeaders.Clear
ListView1.Gridlines = True
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.LabelEdit = lvwManual
ListView1.Font.Bold = True
ListView1.ColumnHeaders.Add , , "satır no", 0
For i = 1 To Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
With ListView1.ColumnHeaders
.Add , , Cells(1, i), Cells(1, i).Width
End With
Next
ad = TextBox1.Text
Set sh = Sheets(ActiveSheet.Name)
yer = xlValues
yer1 = xlWhole
ListView1.ListItems.Clear
sat = 0
X = 0
If WorksheetFunction.CountA(Sheets(ActiveSheet.Name).Cells) > 0 Then
satır = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
sutun = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Else
satır = 1
sutun = 1
End If
With sh.Range(Cells(2, 1), Cells(satır, sutun))
Set d = .Find(What:=ad, After:=.Cells(.Cells.Count), LookIn:=yer, LookAt:=yer1, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not d Is Nothing Then
FirstAddress = d.Address
Do
If Val(d.Row) > sat Then
sat = d.Row
X = X + 1
ListView1.ListItems.Add , , d.Row
With ListView1.ListItems(X).ListSubItems
For R = 1 To sutun
.Add , , sh.Cells(d.Row, R)
If R = d.Column Then
ListView1.ListItems(X).ListSubItems(d.Column).ForeColor = 255
End If
Next
End With
Else
End If
ListView1.ListItems(X).ListSubItems(d.Column).ForeColor = 255
Set d = .FindNext(d)
Loop While Not d Is Nothing And d.Address <> FirstAddress
End If
End With
Set sh = Nothing
If TextBox1 = "" Then
'MsgBox "aranacak değeri yazmadınız.?"
Call UserForm_Initialize
End If
lItemCount = ListView1.ListItems.Count
TextBox90.Value = lItemCount & " adet veri listelendi"
End Sub
Private Sub TextBox1_Change() 'ARAMA TEXT KUTUSU
ListView1.ListItems.Clear
ListView1.ColumnHeaders.Clear
ListView1.Gridlines = True
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.LabelEdit = lvwManual
ListView1.Font.Bold = True
ListView1.ColumnHeaders.Add , , "satır no", 0
For i = 1 To Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
With ListView1.ColumnHeaders
.Add , , Cells(1, i), Cells(1, i).Width
End With
Next
ad = TextBox1.Text
Set sh = Sheets(ActiveSheet.Name)
yer = xlValues
yer1 = xlWhole
ListView1.ListItems.Clear
sat = 0
X = 0
If WorksheetFunction.CountA(Sheets(ActiveSheet.Name).Cells) > 0 Then
satır = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
sutun = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Else
satır = 1
sutun = 1
End If
With sh.Range(Cells(2, 1), Cells(satır, sutun))
Set d = .Find(What:=ad, After:=.Cells(.Cells.Count), LookIn:=yer, LookAt:=yer1, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not d Is Nothing Then
FirstAddress = d.Address
Do
If Val(d.Row) > sat Then
sat = d.Row
X = X + 1
ListView1.ListItems.Add , , d.Row
With ListView1.ListItems(X).ListSubItems
For R = 1 To sutun
.Add , , sh.Cells(d.Row, R)
If R = d.Column Then
ListView1.ListItems(X).ListSubItems(d.Column).ForeColor = 255
End If
Next
End With
Else
End If
ListView1.ListItems(X).ListSubItems(d.Column).ForeColor = 255
Set d = .FindNext(d)
Loop While Not d Is Nothing And d.Address <> FirstAddress
End If
End With
Set sh = Nothing
If TextBox1 = "" Then
'MsgBox "aranacak değeri yazmadınız.?"
Call UserForm_Initialize
End If
lItemCount = ListView1.ListItems.Count
TextBox90.Value = lItemCount & " adet veri listelendi"
End Sub
