I am writing a macro which i need to search through a list of data containing
peoples names, and if found return the value in the cell adjacent to it on
the right.
This i can do, however the list of names changes depending on whether or not
they have met all their deadlines, so if they have a good month they will not
appear on the list.
Can i get the macro to do something if it finds the name in the list, and
something else if it doesn't?
How would i write this?
Many thanks for your help
Jody
Don Guillett - 13 Oct 2006 13:18 GMT
have a look in the vba help index for FINDNEXT. There is an excellent
example.

Signature
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
>I am writing a macro which i need to search through a list of data
>containing
[quoted text clipped - 15 lines]
>
> Jody
traineeross - 13 Oct 2006 15:24 GMT
Cheers for your reply however I can get the macro to find every thing i want
it to, the problem is when it searches and there is nothing to find as the
name isn't on the list (this is because the staff member has met all
deadlines and isn't on the list) this results in an error message saying it
couldn't be found.
I then need to get the macro to accept the error and proceed to the next
name search.
This needs to be included in every search as they may in any month not
appear on the list .
Many thanks Jody Williams
> have a look in the vba help index for FINDNEXT. There is an excellent
> example.
[quoted text clipped - 18 lines]
> >
> > Jody
Don Guillett - 13 Oct 2006 15:45 GMT
cheers for looking at the example cited
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

Signature
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
> Cheers for your reply however I can get the macro to find every thing i
> want
[quoted text clipped - 38 lines]
>> >
>> > Jody
Otto Moehrbach - 13 Oct 2006 13:30 GMT
Something like this perhaps. HTH Otto
Sub FindName()
Dim ThingToGet As Variant
Dim RngColA As Range 'Range to search
'Set RngColA = Set the range to search
If RngColA.Find(What:="The name to find", LookAt:=xlWhole) Is Nothing
Then _
'Things to do if name is not found
ThingToGet = RngColA.Find(What:="The name to find",
LookAt:=xlWhole).Offset(, 1).Value
End Sub
>I am writing a macro which i need to search through a list of data
>containing
[quoted text clipped - 15 lines]
>
> Jody