Robyrubyjane
New Member
- Joined
- Feb 8, 2023
- Messages
- 13
- Office Version
- 365
- Platform
- Windows
Hello, im looking for help. so i was made a search engine with VBA
For example i would like to search Surname "Ace bisa", and I write "Ace" on kata kunci, and the result will shown.
but when I write "bisa" the data wasn't found.
can you guys help me to fix this?
Thanks in advance
*I want to upload the file but i dont know how to upload it
here is the code
For example i would like to search Surname "Ace bisa", and I write "Ace" on kata kunci, and the result will shown.
but when I write "bisa" the data wasn't found.
can you guys help me to fix this?
Thanks in advance
*I want to upload the file but i dont know how to upload it
here is the code
VBA Code:
Private Sub CARIDATA_Click()
On Error GoTo SALAH
If Me.KANTORCABANG.Value = "" Then
Call MsgBox("Silahkan Pilih Kantor Cabang terlebih dahulu", vbInformation, "Cari Data")
End If
If Me.KANTORCABANG.Value = "Surabaya" Then
Set CariSurabaya = Sheet1
CariSurabaya.Range("I1").Value = Me.BERDASARKAN.Value
CariSurabaya.Range("I2").Value = Me.KATAKUNCI.Value
CariSurabaya.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Sheet1.Range("I1:I2"), Copytorange:=Sheet1.Range("K1:Q1"), Unique:=False
Me.TABELDATA.RowSource = Sheet1.Range("HasilSurabaya").ADDRESS(external:=True)
Me.HASILCARI.Caption = Me.TABELDATA.ListCount
End If
If Me.KANTORCABANG.Value = "Jakarta" Then
Set CariSurabaya = Sheet2
CariSurabaya.Range("I1").Value = Me.BERDASARKAN.Value
CariSurabaya.Range("I2").Value = Me.KATAKUNCI.Value
CariSurabaya.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Sheet2.Range("I1:I2"), Copytorange:=Sheet2.Range("K1:Q1"), Unique:=False
Me.TABELDATA.RowSource = Sheet2.Range("HASILJAKARTA").ADDRESS(external:=True)
Me.HASILCARI.Caption = Me.TABELDATA.ListCount
End If
If Me.KANTORCABANG.Value = "Semarang" Then
Set CariSurabaya = Sheet3
CariSurabaya.Range("I1").Value = Me.BERDASARKAN.Value
CariSurabaya.Range("I2").Value = Me.KATAKUNCI.Value
CariSurabaya.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Sheet3.Range("I1:I2"), Copytorange:=Sheet3.Range("K1:Q1"), Unique:=False
Me.TABELDATA.RowSource = Sheet3.Range("HASILSEMARANG").ADDRESS(external:=True)
Me.HASILCARI.Caption = Me.TABELDATA.ListCount
End If
Exit Sub
SALAH:
Call MsgBox("Maaf data yang dicari tidak ditemukan", vbInformation, "Cari Data")
End Sub
Private Sub KANTORCABANG_Change()
If Me.KANTORCABANG.Value = "Surabaya" Then
Me.TABELDATA.RowSource = Sheet1.Range("TABELSURABAYA").ADDRESS(external:=True)
End If
If Me.KANTORCABANG.Value = "Jakarta" Then
Me.TABELDATA.RowSource = Sheet2.Range("TABELJAKARTA").ADDRESS(external:=True)
End If
If Me.KANTORCABANG.Value = "Semarang" Then
Me.TABELDATA.RowSource = Sheet3.Range("TABELSEMARANG").ADDRESS(external:=True)
End If
End Sub
Private Sub RESET_Click()
Me.BERDASARKAN.Value = ""
Me.KANTORCABANG.Value = ""
Me.KATAKUNCI.Value = ""
Me.TABELDATA.RowSource = ""
Me.HASILCARI.Caption = ""
End Sub
Private Sub TABELDATA_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
With FORMKARYAWAN
.ID.Value = Me.TABELDATA.Value
.SURNAME.Value = Me.TABELDATA.Column(1)
.FIRSTNAME.Value = Me.TABELDATA.Column(2)
.ADDRESS.Value = Me.TABELDATA.Column(3)
.PHONE.Value = Me.TABELDATA.Column(4)
.MOBILE.Value = Me.TABELDATA.Column(5)
.EMAIL.Value = Me.TABELDATA.Column(6)
End With
FORMKARYAWAN.Show
End Sub
Private Sub UserForm_Initialize()
With KANTORCABANG
.AddItem "Surabaya"
.AddItem "Jakarta"
.AddItem "Semarang"
End With
With BERDASARKAN
.AddItem "ID"
.AddItem "Surname"
.AddItem "First Name"
End With
End Sub