Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
randomly select a cell from an array | Excel Discussion (Misc queries) | |||
Select OR Activate ? Which when and Why? | Excel Programming | |||
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... | Excel Programming | |||
select vs activate | Excel Programming | |||
select vs activate | Excel Programming |