How to find a word then cross reference to see if match

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi good morning hope you can help me please, as i have no idea where to start. In sheet1, In Row A i have peoples names and in Row S i have skills like LV or HV. In Sheet2 i have the data of what person has ie in row a - joe bloggs, and in row s he has skills LV and HV. I would like some code in sheet1 to look at row a and row s for the word 'hv' and do a cross reference with sheet 2 to see if there are any people that dont have the hv skill and highlight this in a message box. Please can you help with this it would be greatly appreciated.

I have only done the below vba code which finds the word 'HV' and highlights the cells in a message box. but this is not what i want and dont know how to amend it to how i want it.
VBA Code:
Option Explicit

Private Sub CommandButton1_Click()

        Dim rngResult As Range
        Dim strToFind As String

        'Set to your desired string to find
        strToFind = "HV"

        'If the string you are searching for is located in
        'the worksheet somewhere, you can set the value
        'like this:  strToFind = Worksheets("Sheet1").Range("S").Value
        

        'Look in the used range of a given worksheet
        'Change Sheet1 to match your worksheet name
        With Worksheets("Sheet1").UsedRange

                'Find the first cell that contains the search term
                Set rngResult = .Find(What:=strToFind, LookAt:=xlPart)

                'If it is found, grab the cell address of where the
                'search term can be found
                If Not rngResult Is Nothing Then
                        Dim firstAddress As String, result As String
                        firstAddress = rngResult.Address

                'Loop through the rest of the cells until returning
                'to the first cell that we had a match in.
                Do
                        'Record the cell address of the match
                        'to the result string
                        result = result & rngResult.Address & ","

                        'Go to next cell containing the search term
                        Set rngResult = .FindNext(rngResult)

                'Exit the loop when we reach the starting point
                Loop While rngResult.Address <> firstAddress

                'Output the list of cells that contain the string to find
                MsgBox "Found """ & strToFind & """ in cell(s): " & result

                End If
        End With

End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top