I have this code that looks for a match using the value that an user entered via input box. I want the found data to be highlighted but my code isn't doing that.
Dim holdstr As String
Dim fset As Range
holdstr = UCase(InputBox("Enter name"))
For i = 2 To Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
If holdstr = Sheet1.Cells(i, 1).Value Then
MsgBox "Record found!", vbInformation, "Message"
txtFirst.Text = Sheet1.Cells(i, 1).Value
txtLast.Text = Sheet1.Cells(i, 2).Value
txtMid.Text = Sheet1.Cells(i, 3).Value
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Next i