An implementation of Visual Basic that is built into Microsoft products.
Hello @SteveD ,
Thanks for your question.
Yes, it's absolutely possible. You can refer to these following code examples:
- In Microsoft Word:
Sub SelectText()
Dim oRange As Range
With Selection.Find
.Text = "5PBPX"
.Execute
End With
If Selection.Find.Found Then
MsgBox "Text '5PBPX' found and selected!"
Else
MsgBox "Text not found."
End If
End Sub
- In Microsoft Excel, when you want to select a cell containing "5PBPX":
Sub SelectCellWithText()
Dim cell As Range
Set cell = ActiveSheet.Cells.Find(What:="5PBPX", LookIn:=xlValues, LookAt:=xlWhole)
If Not cell Is Nothing Then
cell.Select
MsgBox "Cell " & cell.Address & " containing '5PBPX' is selected!"
Else
MsgBox "Text '5PBPX' not found."
End If
End Sub
I hope this was helpful to you. If so, I’d appreciate it if you could provide feedback using the guidance.