View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych[_6_] Tim Zych[_6_] is offline
external usenet poster
 
Posts: 5
Default Using Find method

Dim rngToFind as Range
On Error Resume Next
Set rngToFind = Range("A1:A125").Find(What:="Name")
On Error Goto 0
If Not rngToFind Is Nothing Then
rngToFind.Select
End If

Perhaps Match would suit better since you are applying some kind of indexing
system. Match returns the relative position of an item within a list.
Dim varRes as Variant
varRes = Application.Match("Name", Range("A1:A125"),0)
If Not isError(varRes) Then
Msgbox "index position is " & varRes
Else
Msgbox "Couldn't find it."
End If


"wade " wrote in message
...
Hello - I am using a find method to search for a name in a given range.
For example, i use something like this,

Range("A1:A125").Find ("Name").select

to select the cell so that I can reference the row index. My problem
is handling those names that do not exist at the time.
The list will eventually have the name but at certain points of the
month it will not. how do i get around this problem. I have tried to
jusst through it into an error handler, but this is messy. Pls help

wade


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