Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cells.find...

Having used the following how do I amend it so that if the search fail
to find the name in column B of Sheet2 it goes on to check column B o
Sheet3? Also how do I prevent it from crashing when the entered name i
not found at all??

Sub FIND_NAME()

Dim MyName As String
MyName = ActiveSheet.Range("A1").Value
Sheets("Sheet2").Activate
Sheets("Sheet2").Cells.Find(What:=MyName, _
LookAt:=xlPart, MatchCase:=False).Activate

End Sub

Any help/pointers would be greatly appreciated

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cells.find...

try this to avoid the nono stopping cycle

Dim MyName As RANGE
MyName = ActiveSheet.Range("A1").Value

For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

'checks to the last USED cell


If Not MyName Is Nothing Then

Sheets("Sheet2").Activate
Sheets("Sheet2").Cells.Find(What:=MyName, _
LookAt:=xlPart, MatchCase:=False).Activate

'do whatever it is you want to do.....

End If

Next cell


also maybe you can modify it so instead of looking in Sheet2 only, you
may look in allaof them, but not sure if that's what you want


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cells.find...

try this to avoid the nono stopping cycle

Dim MyName As RANGE
MyName = ActiveSheet.Range("A1").Value

For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

'checks to the last USED cell


If Not MyName Is Nothing Then

Sheets("Sheet2").Activate
Sheets("Sheet2").Cells.Find(What:=MyName, _
LookAt:=xlPart, MatchCase:=False).Activate

'do whatever it is you want to do.....

End If

Next cell


also maybe you can modify it so instead of looking in Sheet2 only, you
may look in allaof them, but not sure if that's what you want


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cells.find...

try this to avoid the non stopping cycle

Dim MyName As RANGE
MyName = ActiveSheet.Range("A1").Value

For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

'checks to the last USED cell


If Not MyName Is Nothing Then

Sheets("Sheet2").Activate
Sheets("Sheet2").Cells.Find(What:=MyName, _
LookAt:=xlPart, MatchCase:=False).Activate

'do whatever it is you want to do.....

End If

Next cell


also maybe you can modify it so instead of looking in Sheet2 only, you
may look in allaof them, but not sure if that's what you want


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cells.find...

also maybe you can modify it so instead of looking in Sheet2 only, yo
may look in allaof them, but not sure if that's what you want


I do want it to search 2 sheets at once if this is possible. I am onl
a novice at vb though so I'm not sure how to go about this

--
Message posted from http://www.ExcelForum.com

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
sort spreadsheet, "merged cells" comes up. Find cells? Unmerge ? lowell Excel Discussion (Misc queries) 1 August 20th 06 09:10 AM
How to find multiple cells/replace whole cells w/data dcurylo Excel Discussion (Misc queries) 2 November 30th 05 08:06 PM


All times are GMT +1. The time now is 01:01 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"