hi guys,
here's my current code:
i need to make the above search function case INsensitive, that is if i want to search for 'AbcdeF' it will find 'abcdef' and 'AbCdEf' as well as 'ABCDEF' or any iteration of these...
Also, is it possible to add a wildcard function to the above so that i could search 'Abc' or even 'CdE' and it find all the above examples - if so how?
many thanks in advance for any help
here's my current code:
Code:
Private Sub Search_Click()
Dim datatoFind
Dim sheetCount As Integer
Dim counter As Integer
Dim currentSheet As Integer
On Error Resume Next
currentSheet = ActiveWorkbook.Index
datatoFind = InputBox()
If datatoFind = "" Then Exit Sub
sheetCount = ActiveWorkbook.Sheets.Count
If IsError(CDbl(datatoFind)) = False Then datatoFind = CDbl(datatoFind)
For counter = 1 To sheetCount
Sheets(counter).Activate
Cells.Find(what:=datatoFind, after:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlColumns, SearchDirection:=xlNext, MatchCase:= _
False).Activate
If ActiveCell.Value = datatoFind Then Exit Sub
Next counter
If ActiveCell.Value <> datatoFind Then
MsgBox ("The search returned no hits.")
Sheets(currentSheet).Activate
End If
End Sub
i need to make the above search function case INsensitive, that is if i want to search for 'AbcdeF' it will find 'abcdef' and 'AbCdEf' as well as 'ABCDEF' or any iteration of these...
Also, is it possible to add a wildcard function to the above so that i could search 'Abc' or even 'CdE' and it find all the above examples - if so how?
many thanks in advance for any help
Last edited: