Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
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) | |||
sort spreadsheet, "merged cells" comes up. Find cells? Unmerge ? | Excel Discussion (Misc queries) | |||
How to find multiple cells/replace whole cells w/data | Excel Discussion (Misc queries) |