Merhaba
Aşağıdaki koddaki hatayı bulamadım.
Sub Filtre2()
Set S2 = Sheets("Hesaplar")
sat2 = S2.Cells(65536, 1).End(xlUp).Row
ListView2.ListItems.Clear
'CB = ComboBox2.Value 'CStr(ComboBox2.Value)
With ListView2
For j = 1 To sat2
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And Application.WorksheetFunction.IfError(Application.WorksheetFunction.Search(TextBox1.Value, S2.Cells(j, 2), 1), 1) <> 0 Then
i = ListView2.ListItems.Count + 1
.ListItems.Add , , S2.Cells(j, 1)
.ListItems(i).SubItems(1) = S2.Cells(j, 2)
End If
Next
End With
ListView2.FullRowSelect = True
End Sub
Bu kodlar ile ListViewe veri çekmeye çalışıyorum. İstediğim TextBox1 de yazılanı içeren hücreleri eklemek.
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And Application.WorksheetFunction.IfError(Application.WorksheetFunction.Search(TextBox1.Value, S2.Cells(j, 2), 1), 1) <> 0 Then
kısmı sürekli hata veriyor. Kodun hiçbir yerini değiştirmeden sadece bu kısımda
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And S2.Cells(j, 1) =TextBox1.Value Then
şeklinde çalışıyor. ancak istediğim TextBox daki yazılanı içermesi
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And S2.Cells(j, 1) ="*" & TextBox1.Value & "*" Then
şeklinde yaptım ancak çalışmadı. Bu sebeple Application.Worksheet i kullandım anacak yine hata aldım. TextBox dakini Search ( Bildiğim Türkçe karşılığı MBUL formülü ) ile aratıp IfError alırsam değeri 1 olsun almazsam oluşan değer, 0 dan farklı olursa hücreyi eklemek istiyorum ancak yapamadım.
Yardımlarınızı bekliyorum.
Esenlikler dilerim. İyi çalışmalar.
Aşağıdaki koddaki hatayı bulamadım.
Sub Filtre2()
Set S2 = Sheets("Hesaplar")
sat2 = S2.Cells(65536, 1).End(xlUp).Row
ListView2.ListItems.Clear
'CB = ComboBox2.Value 'CStr(ComboBox2.Value)
With ListView2
For j = 1 To sat2
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And Application.WorksheetFunction.IfError(Application.WorksheetFunction.Search(TextBox1.Value, S2.Cells(j, 2), 1), 1) <> 0 Then
i = ListView2.ListItems.Count + 1
.ListItems.Add , , S2.Cells(j, 1)
.ListItems(i).SubItems(1) = S2.Cells(j, 2)
End If
Next
End With
ListView2.FullRowSelect = True
End Sub
Bu kodlar ile ListViewe veri çekmeye çalışıyorum. İstediğim TextBox1 de yazılanı içeren hücreleri eklemek.
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And Application.WorksheetFunction.IfError(Application.WorksheetFunction.Search(TextBox1.Value, S2.Cells(j, 2), 1), 1) <> 0 Then
kısmı sürekli hata veriyor. Kodun hiçbir yerini değiştirmeden sadece bu kısımda
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And S2.Cells(j, 1) =TextBox1.Value Then
şeklinde çalışıyor. ancak istediğim TextBox daki yazılanı içermesi
If CStr(Left((S2.Cells(j, 1)), 3)) = CStr(ComboBox2.Value) And S2.Cells(j, 1) ="*" & TextBox1.Value & "*" Then
şeklinde yaptım ancak çalışmadı. Bu sebeple Application.Worksheet i kullandım anacak yine hata aldım. TextBox dakini Search ( Bildiğim Türkçe karşılığı MBUL formülü ) ile aratıp IfError alırsam değeri 1 olsun almazsam oluşan değer, 0 dan farklı olursa hücreyi eklemek istiyorum ancak yapamadım.
Yardımlarınızı bekliyorum.
Esenlikler dilerim. İyi çalışmalar.
