#1   Report Post  
Ed
 
Posts: n/a
Default Help Please!

Can anyone tell me how to accomplish the following:

I have two worksheets with 3 columns (Full Name, Display Name, AccountName).
The values in the €śAccountName€ť column are the same in both worksheet, but
the values in the other two are different. I need to find a way to search the
two worksheets and when the AccountName in both worksheets match, I would
like to copy the AccountName, Full Name, and Display Name values to a new
worksheet.

Thanks for your assistance!



  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Help Please!

Ed,

Here is a macro. Wasn't sure which version of A & B to use, so I took the
first sheet

Sub Test()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim sh3 As Worksheet
Dim iLastRow As Long
Dim iPos As Long
Dim iRow As Long
Dim i As Long

Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")
Set sh3 = Worksheets("Sheet3")

With sh1
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If Not IsError(Application.Match(.Cells(i, "C").Value,
sh2.Range("C:C"), 0)) Then
iRow = iRow + 1
.Cells(i, "A").Resize(, 3).Copy sh3.Cells(iRow, "A")
End If
Next i
End With

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ed" wrote in message
...
Can anyone tell me how to accomplish the following:

I have two worksheets with 3 columns (Full Name, Display Name,

AccountName).
The values in the "AccountName" column are the same in both worksheet, but
the values in the other two are different. I need to find a way to search

the
two worksheets and when the AccountName in both worksheets match, I would
like to copy the AccountName, Full Name, and Display Name values to a new
worksheet.

Thanks for your assistance!





  #3   Report Post  
Ed
 
Posts: n/a
Default Help Please!

Hi Bob - THANKS a bunch for your help... However, I get the following error
when running the macro:

If Not IsError(Application.Match(.Cells(i, "C").Value,
sh2.Range("C:C"), 0)) Then

Does this make sense?

Thanks!

"Ed" wrote:

Can anyone tell me how to accomplish the following:

I have two worksheets with 3 columns (Full Name, Display Name, AccountName).
The values in the €śAccountName€ť column are the same in both worksheet, but
the values in the other two are different. I need to find a way to search the
two worksheets and when the AccountName in both worksheets match, I would
like to copy the AccountName, Full Name, and Display Name values to a new
worksheet.

Thanks for your assistance!



  #4   Report Post  
Ed
 
Posts: n/a
Default Help Please!

Correction. The error is actuall "Invalid outside proceedure"

"Ed" wrote:

Can anyone tell me how to accomplish the following:

I have two worksheets with 3 columns (Full Name, Display Name, AccountName).
The values in the €śAccountName€ť column are the same in both worksheet, but
the values in the other two are different. I need to find a way to search the
two worksheets and when the AccountName in both worksheets match, I would
like to copy the AccountName, Full Name, and Display Name values to a new
worksheet.

Thanks for your assistance!



  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default Help Please!

Maybe it was just line wrap.

Try adding a space, then underscore after that top line:

If Not IsError(Application.Match(.Cells(i, "C").Value, _
sh2.Range("C:C"), 0)) Then

(Or put it all on one line)

Ed wrote:

Hi Bob - THANKS a bunch for your help... However, I get the following error
when running the macro:

If Not IsError(Application.Match(.Cells(i, "C").Value,
sh2.Range("C:C"), 0)) Then

Does this make sense?

Thanks!

"Ed" wrote:

Can anyone tell me how to accomplish the following:

I have two worksheets with 3 columns (Full Name, Display Name, AccountName).
The values in the €śAccountName€ť column are the same in both worksheet, but
the values in the other two are different. I need to find a way to search the
two worksheets and when the AccountName in both worksheets match, I would
like to copy the AccountName, Full Name, and Display Name values to a new
worksheet.

Thanks for your assistance!




--

Dave Peterson


  #6   Report Post  
Ed
 
Posts: n/a
Default Help Please!

That was it!

Thanks so much for your help!

This will save me a great deal of time, and your help was much appreciated.

Thanks!
Ed


"Ed" wrote:

Can anyone tell me how to accomplish the following:

I have two worksheets with 3 columns (Full Name, Display Name, AccountName).
The values in the €śAccountName€ť column are the same in both worksheet, but
the values in the other two are different. I need to find a way to search the
two worksheets and when the AccountName in both worksheets match, I would
like to copy the AccountName, Full Name, and Display Name values to a new
worksheet.

Thanks for your assistance!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"