ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help Please! (https://www.excelbanter.com/excel-discussion-misc-queries/55157-help-please.html)

Ed

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!




Bob Phillips

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!






Ed

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!




Ed

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!




Dave Peterson

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

Ed

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!





All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com