I have a userform for the user to use a search engine on what he needs.
the following code I have written it, but it is only good if he writes exact wording of the document name.
How can I twist the code to make the search look for approximate words, example
if he types "shirt", the the search will look for all document name that has shirt or shirts in their title.
Private Sub ok_1_Click()
'if no name selected
If Trim(Me.Document_box.Value) = "" Then
MsgBox "Please write a document name."
Exit Sub
End If
'Erase data
Sheets("Search").Select
Range("A2:AP5").Select
Selection.Delete Shift:=xlUp
Range("A6:AP6").Select
Selection.Delete Shift:=xlUp
'Search from the tab
Sheets("Result").Select
Cells(2, 53).Select
ActiveCell = Trim(Me.Document_box.Value) 'BA5 : copier first name
Unload Me
'AZ5 = match (row value)
'Copy Results in another sheet
counter = Cells(2, 52).Value
counter_1 = Cells(2, 52).Value + 1
Cells(counter, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Range("F2").Select
Sheets("Search").Select
ActiveSheet.Range("A2").Select
ActiveSheet.Paste
ActiveSheet.Range("A2").Select
Sheets("Result").Select
If Cells(2, 54) = Cells(2, 55) Then
ActiveSheet.Cells(counter_1, 1).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Range("F2").Select
Sheets("Search").Select
ActiveSheet.Range("A2").Select
ActiveSheet.Paste
ActiveSheet.Range("A2").Select
Else
Sheets("Search").Select
End If
End Sub
the following code I have written it, but it is only good if he writes exact wording of the document name.
How can I twist the code to make the search look for approximate words, example
if he types "shirt", the the search will look for all document name that has shirt or shirts in their title.
Private Sub ok_1_Click()
'if no name selected
If Trim(Me.Document_box.Value) = "" Then
MsgBox "Please write a document name."
Exit Sub
End If
'Erase data
Sheets("Search").Select
Range("A2:AP5").Select
Selection.Delete Shift:=xlUp
Range("A6:AP6").Select
Selection.Delete Shift:=xlUp
'Search from the tab
Sheets("Result").Select
Cells(2, 53).Select
ActiveCell = Trim(Me.Document_box.Value) 'BA5 : copier first name
Unload Me
'AZ5 = match (row value)
'Copy Results in another sheet
counter = Cells(2, 52).Value
counter_1 = Cells(2, 52).Value + 1
Cells(counter, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Range("F2").Select
Sheets("Search").Select
ActiveSheet.Range("A2").Select
ActiveSheet.Paste
ActiveSheet.Range("A2").Select
Sheets("Result").Select
If Cells(2, 54) = Cells(2, 55) Then
ActiveSheet.Cells(counter_1, 1).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Range("F2").Select
Sheets("Search").Select
ActiveSheet.Range("A2").Select
ActiveSheet.Paste
ActiveSheet.Range("A2").Select
Else
Sheets("Search").Select
End If
End Sub