Sub Select_Select()
Dim rngFind As Range
Dim strValueToPick As String
Dim rngPicked As Range
Dim rngLook As Range
Dim strFirstAddress As String
'Select all cells
Cells.Select
'We will be searching in the active selection
Set rngLook = Selection
'We are looking for 39
'Replace xlwhole with xlpart if you do not want exact match
strValueToPick = "39"
With rngLook
Set rngFind = .Find(strValueToPick, .Cells(1, 1), LookIn:=xlValues, lookat:=xlWhole)
If Not rngFind Is Nothing Then
strFirstAddress = rngFind.Address
Set rngPicked = rngFind
Do
Set rngPicked = Union(rngPicked, rngFind)
Set rngFind = .FindNext(rngFind)
Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstAddress
End If
End With
'this selects the cells
If Not rngPicked Is Nothing Then
rngPicked.Select
End If
End Sub
Bookmarks