Aynı anda A,B,C sütunlarında arama yapmak.

Katılım
16 Eylül 2010
Mesajlar
34
Excel Vers. ve Dili
2007
TextBox'a girilen metni A,B,C Sutunlarında aynı anda arama yaparak ListBox1'de listelemekistiyorum.

Şuan benim kullandığım TextBox1'e metin giriyorum ComboBox1'den kategori seçiyorum ve Listebox1'de listeliyorum.
ComboBox1'e bir alan açıp TÜM alanları diyip ABC sütünlarında aynı anda arama yaparak listeleyebilirmiyim.

Private Sub UserForm_Initialize()
Kod:
Private Sub UserForm_Initialize()

Dim i As Long
Dim s As String
     s = "this is line "
     For i = 1 To 50
             Me.ListBox1.AddItem s & i
     Next

Call RemoveCaption(Me)

TextBox13.SetFocus

ListBox1.ColumnWidths = "35;110;60"        'COLUMN WITH OF LISTBOX
ListBox1.ColumnCount = 3                   'COLUMN NUMBER OF LISTBOX
ListBox1.List = Sheets("Data").Range("a2:l" & [a65536].End(3).row).Value

'** SEARCH COMBOBOX
ComboBox1.AddItem "Ad"
ComboBox1.AddItem "Siparis"
ComboBox1.AddItem "Tc"

'**********************************************

TextBox14.Value = ListBox1.ListCount
TextBox15.Value = 0
With lblDone ' set the "progress bar" to it's initial length
        .Top = lblRemain.Top + 1
        .Left = lblRemain.Left + 1
        .Height = lblRemain.Height - 2
        .Width = 0
    End With
lblPct.Visible = False

End Sub
Private Sub CommandButton5_Click() 'Arama Butonu
Kod:
Private Sub CommandButton5_Click() 'Arama Butonu
Dim sat, s As Integer
Dim deg1, deg2 As String

If TextBox13.Value = "" Then
MsgBox "Hey..! İyimisin..! Birşey yazmadan ne aramaya çalışıyorsun..", vbExclamation
TextBox13.SetFocus
Exit Sub
End If

If ComboBox1.Value = "" Or ComboBox1.Value = "-" Then
MsgBox "Arama ketgorisi seçiniz.", vbExclamation
ComboBox1.SetFocus
Exit Sub
End If

For a = 1 To 12 ' Clear textboxes(1-12)
Controls("textbox" & a) = ""
Next

With ListBox1
.Clear
.ColumnCount = 3
.ColumnWidths = "35;110;50"
End With
Call Main 'Progress Bar

deg2 = TextBox13.Value
Select Case ComboBox1.Value
Case "Ad"
For sat = 2 To Cells(65536, "a").End(xlUp).row
Set deg1 = Cells(sat, "a")
If UCase(Replace(Replace(deg1, "ı", "I"), "i", "İ")) Like "*" & UCase(Replace(Replace(deg2, "ı", "I"), "i", "İ")) & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
ListBox1.List(s, 4) = Cells(sat, "E")
ListBox1.List(s, 5) = Cells(sat, "F")
ListBox1.List(s, 6) = Cells(sat, "G")
ListBox1.List(s, 7) = Cells(sat, "H")
ListBox1.List(s, 8) = Cells(sat, "I")
ListBox1.List(s, 9) = Cells(sat, "J")
ListBox1.List(s, 10) = Cells(sat, "K")
ListBox1.List(s, 11) = Cells(sat, "L")
s = s + 1
End If: Next

Case "Tc"
For sat = 2 To Cells(65536, "c").End(xlUp).row
Set deg1 = Cells(sat, "c")
If UCase(Replace(Replace(deg1, "ı", "I"), "i", "İ")) Like "*" & UCase(Replace(Replace(deg2, "ı", "I"), "i", "İ")) & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
ListBox1.List(s, 4) = Cells(sat, "E")
ListBox1.List(s, 5) = Cells(sat, "F")
ListBox1.List(s, 6) = Cells(sat, "G")
ListBox1.List(s, 7) = Cells(sat, "H")
ListBox1.List(s, 8) = Cells(sat, "I")
ListBox1.List(s, 9) = Cells(sat, "J")
ListBox1.List(s, 10) = Cells(sat, "K")
ListBox1.List(s, 11) = Cells(sat, "L")
s = s + 1
End If: Next

Case "Siparis"
For sat = 2 To Cells(65536, "b").End(xlUp).row
Set deg1 = Cells(sat, "b")
If UCase(Replace(Replace(deg1, "ı", "I"), "i", "İ")) Like "*" & UCase(Replace(Replace(deg2, "ı", "I"), "i", "İ")) & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
ListBox1.List(s, 4) = Cells(sat, "E")
ListBox1.List(s, 5) = Cells(sat, "F")
ListBox1.List(s, 6) = Cells(sat, "G")
ListBox1.List(s, 7) = Cells(sat, "H")
ListBox1.List(s, 8) = Cells(sat, "I")
ListBox1.List(s, 9) = Cells(sat, "J")
ListBox1.List(s, 10) = Cells(sat, "K")
ListBox1.List(s, 11) = Cells(sat, "L")
s = s + 1
End If: Next

Case "Estimated Revenue"
For sat = 2 To Cells(65536, "l").End(xlUp).row
Set deg1 = Cells(sat, "l")
If deg1 Like deg2 & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
ListBox1.List(s, 4) = Cells(sat, "E")
ListBox1.List(s, 5) = Cells(sat, "F")
ListBox1.List(s, 6) = Cells(sat, "G")
ListBox1.List(s, 7) = Cells(sat, "H")
ListBox1.List(s, 8) = Cells(sat, "I")
ListBox1.List(s, 9) = Cells(sat, "J")
ListBox1.List(s, 10) = Cells(sat, "K")
ListBox1.List(s, 11) = Cells(sat, "L")
s = s + 1
End If: Next
End Select

Label15.Caption = ListBox1.ListCount
End Sub

Private Sub UserForm_Initialize()
Kod:
Private Sub UserForm_Initialize()

Dim i As Long
Dim s As String
     s = "this is line "
     For i = 1 To 50
             Me.ListBox1.AddItem s & i
     Next

Call RemoveCaption(Me)

TextBox13.SetFocus

ListBox1.ColumnWidths = "35;110;60"        'COLUMN WITH OF LISTBOX
ListBox1.ColumnCount = 3                   'COLUMN NUMBER OF LISTBOX
ListBox1.List = Sheets("Data").Range("a2:l" & [a65536].End(3).row).Value

'** SEARCH COMBOBOX
ComboBox1.AddItem "Ad"
ComboBox1.AddItem "Siparis"
ComboBox1.AddItem "Tc"

'**********************************************

TextBox14.Value = ListBox1.ListCount
TextBox15.Value = 0
With lblDone ' set the "progress bar" to it's initial length
        .Top = lblRemain.Top + 1
        .Left = lblRemain.Left + 1
        .Height = lblRemain.Height - 2
        .Width = 0
    End With
lblPct.Visible = False

End Sub
 
Üst