Textboxta aranını kapalı dosyadan alıp Listview'de gösterme hk

tigiy

Altın Üye
Katılım
31 Aralık 2013
Mesajlar
138
Excel Vers. ve Dili
2019-Türkçe
Altın Üyelik Bitiş Tarihi
11-09-2025
Herkese merhaba,

Aşağıdaki kodlar ile textbox ya da comboboxlardaki yazılanları data sayfasında aratıyor ve listviewde gösteriyorum ancak aynı userformu birden çok kullanıcının kullanması gerek ve dolayısı ile bu artık işimi görmüyor. Bende şöyle bir şey düşündüm veri tabanı kapalı bir dosya olursa sanırım userformu birden çok kullanıcı kullanabilir. Benim istediğim şey ise burada yapılan işlemi kapalı dosyadan almak.

Nasıl yapabilirim?

Kod:
Public Sub CommandButton5_Click()
'Textboxlar ile listviewde arama yapıyoruz
Dim i As Long, birim, yenibirim, deplok, yenideplok, zimmet, yenizimmet, anakategori, altkategori, demirbaşaçıkla, renk, marka, model, serino, demirbaşno, barkodno, yenibarkodno, alınıştarihi, durumu, açıklama1, açıklama2, güncelbarkodno, güncelbirimadı, güncelzimmetlenen, günceldeplok As String


Application.Calculation = xlCalculationManual

Application.Volatile

Set sr = Sheets("DATA")
ListView1.ListItems.Clear
With ListView1
For i = 2 To sr.Cells(65536, 1).End(xlUp).Row
    If ComboBox1.Value = "" Then
        birim = sr.Cells(i, "A").Value
        Else
        birim = ComboBox1.Value
    End If
    If ComboBox2.Value = "" Then
        yenibirim = sr.Cells(i, "B").Value
        Else
        yenibirim = ComboBox2.Value
    End If
    If ComboBox3.Value = "" Then
        deplok = sr.Cells(i, "C").Value
        Else
        deplok = ComboBox3.Value
    End If
    If ComboBox4.Value = "" Then
        yenideplok = sr.Cells(i, "D").Value
        Else
        yenideplok = ComboBox4.Value
    End If
    If ComboBox5.Value = "" Then
        zimmet = sr.Cells(i, "E").Value
        Else
        zimmet = ComboBox5.Value
    End If
    If ComboBox6.Value = "" Then
        yenizimmet = sr.Cells(i, "F").Value
        Else
        yenizimmet = ComboBox6.Value
    End If
        If ComboBox7.Value = "" Then
        anakategori = sr.Cells(i, "G").Value
        Else
        anakategori = ComboBox7.Value
    End If
        If ComboBox8.Value = "" Then
        altkategori = sr.Cells(i, "H").Value
        Else
        altkategori = ComboBox8.Value
    End If
    If ComboBox9.Value = "" Then
        demirbaşaçıkla = sr.Cells(i, "I").Value
        Else
        demirbaşaçıkla = ComboBox9.Value
    End If
    If ComboBox10.Value = "" Then
        renk = sr.Cells(i, "J").Value
        Else
        renk = ComboBox10.Value
    End If
    If ComboBox11.Value = "" Then
        marka = sr.Cells(i, "K").Value
        Else
        marka = ComboBox11.Value
    End If
    If ComboBox12.Value = "" Then
        model = sr.Cells(i, "L").Value
        Else
        model = ComboBox12.Value
    End If
    If TextBox13.Value = "" Then
        serino = sr.Cells(i, "M").Value
        Else
        serino = TextBox13.Value
    End If
    If TextBox14.Value = "" Then
        demirbaşno = sr.Cells(i, "N").Value
        Else
        demirbaşno = TextBox14.Value
    End If
    If TextBox15.Value = "" Then
        barkodno = sr.Cells(i, "O").Value
        Else
        barkodno = TextBox15.Value
    End If
    If TextBox16.Value = "" Then
        yenibarkodno = sr.Cells(i, "P").Value
        Else
        yenibarkodno = TextBox16.Value
    End If
    If TextBox17.Value = "" Then
        alınıştarihi = sr.Cells(i, "Q").Value
        Else
        alınıştarihi = TextBox17.Value
    End If
    If TextBox18.Value = "" Then
        durumu = sr.Cells(i, "R").Value
        Else
        durumu = TextBox18.Value
    End If
    If TextBox20.Value = "" Then
        açıklama1 = sr.Cells(i, "T").Value
        Else
        açıklama1 = TextBox20.Value
    End If
    If TextBox21.Value = "" Then
        açıklama2 = sr.Cells(i, "U").Value
        Else
        açıklama2 = TextBox21.Value
    End If
     If TextBox22.Value = "" Then
        güncelbarkodno = sr.Cells(i, "V").Value
        Else
        güncelbarkodno = TextBox22.Value
    End If
     If TextBox23.Value = "" Then
        güncelbirimadı = sr.Cells(i, "W").Value
        Else
        güncelbirimadı = TextBox23.Value
    End If
    If TextBox24.Value = "" Then
        güncelzimmetlenen = sr.Cells(i, "X").Value
        Else
        güncelzimmetlenen = TextBox24.Value
    End If
    If TextBox25.Value = "" Then
        günceldeplok = sr.Cells(i, "Y").Value
        Else
        günceldeplok = TextBox25.Value
    End If
    
    
    
    birim = UCase(Replace(Replace(birim, "ı", "I"), "i", "İ"))
    yenibirim = UCase(Replace(Replace(yenibirim, "ı", "I"), "i", "İ"))
    deplok = UCase(Replace(Replace(deplok, "ı", "I"), "i", "İ"))
    yenideplok = UCase(Replace(Replace(yenideplok, "ı", "I"), "i", "İ"))
    zimmet = UCase(Replace(Replace(zimmet, "ı", "I"), "i", "İ"))
    yenizimmet = UCase(Replace(Replace(yenizimmet, "ı", "I"), "i", "İ"))
    anakategori = UCase(Replace(Replace(anakategori, "ı", "I"), "i", "İ"))
    altkategori = UCase(Replace(Replace(altkategori, "ı", "I"), "i", "İ"))
    demirbaşaçıkla = UCase(Replace(Replace(demirbaşaçıkla, "ı", "I"), "i", "İ"))
    renk = UCase(Replace(Replace(renk, "ı", "I"), "i", "İ"))
    marka = UCase(Replace(Replace(marka, "ı", "I"), "i", "İ"))
    model = UCase(Replace(Replace(model, "ı", "I"), "i", "İ"))
    serino = UCase(Replace(Replace(serino, "ı", "I"), "i", "İ"))
    demirbaşno = UCase(Replace(Replace(demirbaşno, "ı", "I"), "i", "İ"))
    barkodno = UCase(Replace(Replace(barkodno, "ı", "I"), "i", "İ"))
    yenibarkodno = UCase(Replace(Replace(yenibarkodno, "ı", "I"), "i", "İ"))
    alınıştarihi = UCase(Replace(Replace(alınıştarihi, "ı", "I"), "i", "İ"))
    durumu = UCase(Replace(Replace(durumu, "ı", "I"), "i", "İ"))
    açıklama1 = UCase(Replace(Replace(açıklama1, "ı", "I"), "i", "İ"))
    açıklama2 = UCase(Replace(Replace(açıklama2, "ı", "I"), "i", "İ"))
    güncelbarkodno = UCase(Replace(Replace(güncelbarkodno, "ı", "I"), "i", "İ"))
    güncelbirimadı = UCase(Replace(Replace(güncelbirimadı, "ı", "I"), "i", "İ"))
    güncelzimmetlenen = UCase(Replace(Replace(güncelzimmetlenen, "ı", "I"), "i", "İ"))
    günceldeplok = UCase(Replace(Replace(günceldeplok, "ı", "I"), "i", "İ"))
    
    
    If UCase(Replace(Replace(sr.Cells(i, "A").Value, "ı", "I"), "i", "İ")) Like "*" & birim & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "B").Value, "ı", "I"), "i", "İ")) Like "*" & yenibirim & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "C").Value, "ı", "I"), "i", "İ")) Like "*" & deplok & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "D").Value, "ı", "I"), "i", "İ")) Like "*" & yenideplok & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "E").Value, "ı", "I"), "i", "İ")) Like "*" & zimmet & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "F").Value, "ı", "I"), "i", "İ")) Like "*" & yenizimmet & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "G").Value, "ı", "I"), "i", "İ")) Like "*" & anakategori & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "H").Value, "ı", "I"), "i", "İ")) Like "*" & altkategori & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "I").Value, "ı", "I"), "i", "İ")) Like "*" & demirbaşaçıkla & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "J").Value, "ı", "I"), "i", "İ")) Like "*" & renk & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "K").Value, "ı", "I"), "i", "İ")) Like "*" & marka & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "L").Value, "ı", "I"), "i", "İ")) Like "*" & model & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "M").Value, "ı", "I"), "i", "İ")) Like "*" & serino & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "N").Value, "ı", "I"), "i", "İ")) Like "*" & demirbaşno & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "O").Value, "ı", "I"), "i", "İ")) Like "*" & barkodno & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "P").Value, "ı", "I"), "i", "İ")) Like "*" & yenibarkodno & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "Q").Value, "ı", "I"), "i", "İ")) Like "*" & alınıştarihi & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "R").Value, "ı", "I"), "i", "İ")) Like "*" & durumu & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "T").Value, "ı", "I"), "i", "İ")) Like "*" & açıklama1 & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "U").Value, "ı", "I"), "i", "İ")) Like "*" & açıklama2 & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "V").Value, "ı", "I"), "i", "İ")) Like "*" & güncelbarkodno & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "W").Value, "ı", "I"), "i", "İ")) Like "*" & güncelbirimadı & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "X").Value, "ı", "I"), "i", "İ")) Like "*" & güncelzimmetlenen & "*" _
    And UCase(Replace(Replace(sr.Cells(i, "Y").Value, "ı", "I"), "i", "İ")) Like "*" & günceldeplok & "*" Then
    
    


    
        ListView1.ListItems.Add , , i
        x = x + 1
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "A")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "B")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "C")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "D")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "E")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "F")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "G")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "H")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "I")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "J")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "K")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "L")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "M")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "N")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "O")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "P")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "Q")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "R")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "S")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "T")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "U")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "V")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "W")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "X")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "Y")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "Z")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "AA")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "AB")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "AC")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "AD")
        .ListItems(x).ListSubItems.Add , , sr.Cells(i, "AE")
        
    End If
    
Next i
End With
If ListView1.ListItems.Count = 0 Then
MsgBox "Aranan Şartlara Uygun Kayıt BULUNAMADI.", vbExclamation + vbOKOnly, "Bulunamadı!"
End If
Set sr = Nothing

Application.Calculation = xlCalculationAutomatic


End Sub
 

Erdem Akdemir

Destek Ekibi
Destek Ekibi
Katılım
4 Mayıs 2007
Mesajlar
3,623
Excel Vers. ve Dili
2016 PRO TÜRKÇE-İNG. 64 BİT
Çok komplike bir işlem,

Öncelikle örnek dosyanızı eklemeniz gerek.
Ado konusu araştırabilirsiniz.Yapabilirseniz veritabanı olarak Access'i kullanın.
 
Üst