KyleJackMorrison
Board Regular
- Joined
- Dec 3, 2013
- Messages
- 107
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
Hello I'm in need of help.
Right here is the back story,
I'm currently away with the United Nations and a apart of my job is to search peoples names and registration before they enter the base. At the moment we have to search over 500 peoples names on a sheet of paper...
I've made an excel sheet with their names and registration numbers on.
I've got a code that I saw on the internet but I would like to tweak it but don't know how.
I would much appreciate it if someone could help me do this:
1. When searching a name it could highlight the row to make it more visible but not permanently highlight it.
2. After the search it could reopen the search box again.
3. Maybe to make it more easy, have a button that would link you to the search pop-up.
Just making this more easier because we have different nationalities that have to use this.
Many thanks,
Kyle
Right here is the back story,
I'm currently away with the United Nations and a apart of my job is to search peoples names and registration before they enter the base. At the moment we have to search over 500 peoples names on a sheet of paper...
I've made an excel sheet with their names and registration numbers on.
I've got a code that I saw on the internet but I would like to tweak it but don't know how.
I would much appreciate it if someone could help me do this:
1. When searching a name it could highlight the row to make it more visible but not permanently highlight it.
2. After the search it could reopen the search box again.
3. Maybe to make it more easy, have a button that would link you to the search pop-up.
Just making this more easier because we have different nationalities that have to use this.
Code:
Sub FindAll() Dim strFind As String
Dim wks As Worksheet
Dim rngFound As Range
Dim lngItems As Long
strFind = InputBox(prompt:="Type in a name or registration to search..", Title:="Search Box,")
If Len(strFind) > 0 Then
For Each wks In ActiveWorkbook.Worksheets
If FindIt(wks, strFind, lngItems) = False Then Exit For
Next wks
End If
MsgBox lngItems & "matches found"
End Sub
Function FindIt(wks As Worksheet, strFind As String, lngMatches As Long) As Boolean
Dim rngFound As Range
Dim strFirstFind As String
FindIt = True
With wks.UsedRange
Set rngFound = .Find(What:=strFind, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
If Not rngFound Is Nothing Then
strFirstFind = rngFound.Address
Do
lngMatches = lngMatches + 1
Application.Goto rngFound, True
If MsgBox("Found items. Is this what you are looking for?", vbYesNo) = vbYes Then
FindIt = False
Exit Do
End If
Set rngFound = .FindNext(rngFound)
Loop While rngFound.Address <> strFirstFind
End If
End With
End Function
Many thanks,
Kyle