View Single Post
  #2   Report Post  
Old August 5th 09, 03:38 PM posted to microsoft.public.excel.worksheet.functions
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
external usenet poster
First recorded activity by ExcelBanter: Nov 2008
Posts: 3,346
Default Compare cells and copy columns after match


One way, not requiring macros is to use VLOOKUP or MATCH. In either case
you could record a macro which enters the formulas and then converts them to

Alternatively you could write a macro that would be something like:

For I = 1 to n
IF Cells(I,1) =Sheets("Reference Data").Cells(I,1) then
Sheets("Reference Data").Range("L" & I) =Range("W" & I)
End if
Next I

Since you are copying non-adjacent cell, I think I should ask which cells go
into which cell L -- Z...

There are many ways to simplify this, but this might be a starting point
If this helps, please click the Yes button.

Shane Devenshire

"Kcope8302" wrote:

I am having an issue developing a simple macro that compares column A in one
worksheet(i.e. PTR) and another worksheet(i.e. Reference Data). If what is in
column A of Reference data matches column A in PTR; I want 4 cells(L.M,N,Q)
from that line in Reference Data copied and placed in PTR(W,X,Y,Z).

What i want is to be able to run the macro from PTR and have it populate
cells W,X,Y,Z with the correct project information from the Reference Data

Please inform me if there is any other information would be needed to