#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
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
Need Cells.find to find first number in a row which is 8000 Kasper Excel Discussion (Misc queries) 9 December 15th 08 02:10 PM
how to find cells that refer to data in other cells in excel Aman Excel Discussion (Misc queries) 8 December 2nd 07 10:02 PM
from a group of cells.find average of cells containing values farm Excel Discussion (Misc queries) 1 December 21st 06 08:50 PM
How to find multiple cells/replace whole cells w/data dcurylo Excel Discussion (Misc queries) 2 November 30th 05 08:06 PM
If Cells.Find can't find anything achidsey Excel Programming 2 November 3rd 05 06:50 PM


All times are GMT +1. The time now is 06:31 AM.

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

About Us

"It's about Microsoft Excel"