Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find
Looping through a column in sheet1 storing the first cell in variable
Y_CellBase, followed by activating sheet 2 and searching for that value. .If theres a match Ive got down what to do. If theres no match on sheet 2 I need to do something else. Im not sure how to handle the issue of no match being found. So spastically put if match found then do this else do that€¦. Worksheets(1). Activate ((Looping code here starting at first cell)) Y_CellBase = ActiveCell.Value Worksheets(2).Activate Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False).Activate Appreciatively, Arturo |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find
Try something like this...
Dim rngFound as range Worksheets(2).Activate set rngFound = Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) if rngFound is Nothing then msgbox "sorry... not found" else rng.select end if -- HTH... Jim Thomlinson "Arturo" wrote: Looping through a column in sheet1 storing the first cell in variable Y_CellBase, followed by activating sheet 2 and searching for that value. .If theres a match Ive got down what to do. If theres no match on sheet 2 I need to do something else. Im not sure how to handle the issue of no match being found. So spastically put if match found then do this else do that€¦. Worksheets(1). Activate ((Looping code here starting at first cell)) Y_CellBase = ActiveCell.Value Worksheets(2).Activate Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False).Activate Appreciatively, Arturo |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find
Worksheets(2).Activate
Set rngFound = Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) If rngFound Is Nothing Then MsgBox "sorry... not found" Else rngFound.Select "Jim Thomlinson" wrote: Try something like this... Dim rngFound as range Worksheets(2).Activate set rngFound = Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) if rngFound is Nothing then msgbox "sorry... not found" else rng.select end if -- HTH... Jim Thomlinson "Arturo" wrote: Looping through a column in sheet1 storing the first cell in variable Y_CellBase, followed by activating sheet 2 and searching for that value. .If theres a match Ive got down what to do. If theres no match on sheet 2 I need to do something else. Im not sure how to handle the issue of no match being found. So spastically put if match found then do this else do that€¦. Worksheets(1). Activate ((Looping code here starting at first cell)) Y_CellBase = ActiveCell.Value Worksheets(2).Activate Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False).Activate Appreciatively, Arturo |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find
When I said "like this" I guess I meant for you to fix the silly mistakes...
;-) Nice catch on that goof... -- HTH... Jim Thomlinson "Arturo" wrote: Worksheets(2).Activate Set rngFound = Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) If rngFound Is Nothing Then MsgBox "sorry... not found" Else rngFound.Select "Jim Thomlinson" wrote: Try something like this... Dim rngFound as range Worksheets(2).Activate set rngFound = Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) if rngFound is Nothing then msgbox "sorry... not found" else rng.select end if -- HTH... Jim Thomlinson "Arturo" wrote: Looping through a column in sheet1 storing the first cell in variable Y_CellBase, followed by activating sheet 2 and searching for that value. .If theres a match Ive got down what to do. If theres no match on sheet 2 I need to do something else. Im not sure how to handle the issue of no match being found. So spastically put if match found then do this else do that€¦. Worksheets(1). Activate ((Looping code here starting at first cell)) Y_CellBase = ActiveCell.Value Worksheets(2).Activate Cells.Find(What:=Y_CellBase, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False).Activate Appreciatively, Arturo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need Cells.find to find first number in a row which is 8000 | Excel Discussion (Misc queries) | |||
how to find cells that refer to data in other cells in excel | Excel Discussion (Misc queries) | |||
from a group of cells.find average of cells containing values | Excel Discussion (Misc queries) | |||
How to find multiple cells/replace whole cells w/data | Excel Discussion (Misc queries) | |||
If Cells.Find can't find anything | Excel Programming |