Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Look up text in an array and select (activate) the cell in which f

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Look up text in an array and select (activate) the cell in which f

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
---------------
Jacob Skaria


"Wes_A" wrote:

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Look up text in an array and select (activate) the cell in whi

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.

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Wes_A" wrote:

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Look up text in an array and select (activate) the cell in whi

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
---------------
Jacob Skaria


"Wes_A" wrote:

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.

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Wes_A" wrote:

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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
randomly select a cell from an array TLC Excel Discussion (Misc queries) 7 April 22nd 23 07:43 PM
Select OR Activate ? Which when and Why? Buffyslay Excel Programming 5 January 16th 07 03:42 PM
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Excel Programming 0 October 19th 06 05:04 PM
select vs activate Ron de Bruin Excel Programming 0 September 9th 04 04:05 PM
select vs activate Chip Pearson Excel Programming 0 September 9th 04 04:02 PM


All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"