View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Birley Dave Birley is offline
external usenet poster
 
Posts: 171
Default Find data in other worksheet

Slicker 'n a pig in poop! On the 8500 lines of WorksheetB, it took 24 minutes
to run -- and saved about 3 days (at least) of the most horrendous type of
data entry -- Manual -- !<G
--
Dave
Temping with Staffmark
in Rock Hill, SC


"Dave Miller" wrote:

Dave the below code will work too:

Regards,

David Miller

***********************Begin Code***********************

Sub getSSN()
Dim WorksheetA, WorksheetB As Worksheet, _
FULL_NAME, CONCAT_NAME, _
C, R As Range


Set WorksheetA = Sheets("WorksheetA")
Set WorksheetB = Sheets("WorksheetB")

Set FULL_NAME = WorksheetB.Range("P1:P" & _

WorksheetB.Range("P65536").End(xlUp).Row)
Set CONCAT_NAME = WorksheetA.Range("B1:B" & _

WorksheetA.Range("B65536").End(xlUp).Row)

For Each C In FULL_NAME
For Each R In CONCAT_NAME
If R.Value & ", " & R.Offset(0, 1).Value = C.Value Then
C.Offset(0, 1).Value = R.Offset(0, -1).Value
End If
Next R
Next C

Set FULL_NAME = Nothing
Set CONCAT_NAME = Nothing
Set WorksheetA = Nothing
Set WorksheetB = Nothing
End Sub