Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|