Look up text in an array and select (activate) the cell in which f

W

Wes_A

Hi all, Using Excel 2007 Macro I need to look up a part number (variable) in
an array containing all part numbers and select & activate the cell in the
array where it is found.
Can anyone help?
 
J

Jacob Skaria

Try the below macro...

Sub Macro()

Dim varRange As Range
Dim varFound As Variant, varSearch As Variant
varSearch = "jacob"
Set varRange = ActiveSheet.Range("A1:J20")
'Replace xlPart with xlWhole if you need a whole cell match
Set varFound = varRange.Find(varSearch, lookat:=xlPart)
If Not varFound Is Nothing Then varFound.Activate

End Sub

If this post helps click Yes
 
W

Wes_A

The problem is that the part number is volatile so I need the Find function
to pick up the volatile content of the cell.
Appologies for the missunderstanding.
 
J

Jacob Skaria

So you can replace the fixed string to the cell as below

Replace
<varSearch = "jacob"
with

varSearch = Range("A1")

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top