I'm having a problem while running my vba code. I want vba to search for all the values within column A in Sheet 1 and compare it to values in column A Sheet 2. If that values doesn't exists, i want the VBA to add text to column E in Sheet 1 to that row.
These are my current code, when i run it VBA didn't give any run time error pop up and doesn't give results as well.Thank you in advance
Sub CheckValues()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim valueToFind As Variant
Dim searchRange As Range
Dim foundCell As Range
Set ws1 = ThisWorkbook.Worksheets("Sheet1")
Set ws2 = ThisWorkbook.Worksheets("Sheet2")
valueToFind = ws1.Range("A:A").Value
Set searchRange = ws2.Range("A:A")
' Search for the value in the search range
Set foundCell = searchRange.Find(what:=valueToFind, LookIn:=xlValues, lookat:=xlWhole)
If foundCell Is Nothing Then
ws1.Range("E" & foundCell.Row).Value = "Resign"
End If
End Sub