View Single Post
  #6   Report Post  
bobf
 
Posts: n/a
Default

At this point I'll take either. Thanks for your reply. I'll try your VBA
code to see if it's what I am looking for.

Thanks

"Rick Hansen" wrote:

Bob f, you really didn't specify if wanted formula or vba code to solve
your problem. Here is alittle bit of vba code as macro that should solve
your problem. This macro can be run fom any sheet.


rgds to ya

Rick

Public Sub FindNameMoveData()
Dim A As Worksheet, B As Worksheet, C As Worksheet
Dim iArow As Integer, iBrow As Integer, iCrow As Integer
Dim Name As String

' set object pointer for each sheet "A","B","C"
Set A = Worksheets("A")
Set B = Worksheets("B")
Set C = Worksheets("C")


iArow = 1 ' set beginning row position
iBrow = 2
iCrow = 2

Application.ScreenUpdating = False ' stop screenupdate
Do Until IsEmpty(A.Cells(iArow, "A")) ' loop thru names on sheet "A"
Name = A.Cells(iArow, "A") ' save name for compare
Do Until IsEmpty(B.Cells(iBrow, "C")) ' loop thru names on sheet
"B"
If Name = B.Cells(iBrow, "C") Then ' find same name in sheet "B"
' copy from sheet "B"
B.Range("A" & CStr(iBrow) & ":" & "I" & CStr(iBrow)).Copy
' paste to sheet "C"
C.Range("A" & CStr(iCrow) & ":" & "I" &
CStr(iCrow)).PasteSpecial (xlPasteValues)
' increment sheet "C" row pointer
iCrow = iCrow + 1
Exit Do ' name was found, exit this loop
End If
iBrow = iBrow + 1
Loop
iBrow = 2
iArow = iArow + 1
Loop
Application.CutCopyMode = False ' clear clipbroad

End Sub ' we B done


"bobf" wrote in message
...
I am trying to use a list of names (first, last) in a colum in worksheetA

to
find corresponding entries in an imported worksheet B, Once I find the

name
in worksheet B I want to extract the entire row of data into another new
worksheet.

For example
Worksheet A:
Column A
Bill Jones
Fred Smith

Worksheet B:
Place Overall Name Swim

Bike
Run Finish
1 12 Bill Jones 24 anytown ST 13:45 54:45
23:00 1:34:45
4 78 Fred Smith 56 anothertown ST 15:00 56:12
24:34 1:48:34

The data in worksheet B in the Name column is all in the same cell (not
different columns)

Now if there is a match between worksheetA name and the name exists in
worksheet B I want to copy the entire row from worksheet B into a new row

in
Worksheet C. Not all names in worksheet A will have an entry in worksheet

B

Any ideas?