Macro Help


Posted by Sam on June 21, 2001 9:52 AM

What I am trying to do is get a macro that will go through a list of data in column 'A' and find a certain name. once the name is found it will copy information from another location on the sheet and paste it in the same row as the name. After it has done that it should go back and find another name and do everything over again. Any advice?

Thanks,
Sam

Posted by Ben O. on June 21, 2001 10:40 AM

You might want to look into using a VLOOKUP formula instead of a macro. But if you need a macro, start by creating the find and paste procedure and then working that into a For Next loop. This code might be able to get you started:

Dim fName As String
fName = InputBox("Enter name:", "Name")
Columns("A:A").Select
Selection.Find(What:=fName, After:=ActiveCell, LookIn:=xlValues _
, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
cCell = ActiveCell.Address
Range(cCell).Offset(0, 1).Select

Good luck

-Ben



Posted by Sam on June 21, 2001 11:34 AM

Thanks

I'm almost there that shot me forward pretty far. Thanks for the great help!

Sam