ユーザーが入力ボックスを介して入力した値を使用して一致を探すこのコードがあります。見つかったデータを強調表示したいのですが、私のコードではそれができません。
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