How to create/run "cell A equals Cell B put Cell C info in Cell D

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to match data in cell A to cell B and then if they equal I need to
copy the adjacent cell C to cell X . How do I set up a macro to do this
automatically? I have over 5000 cells to compare and match up.. Can anyone
help? I have Office 2003.
 
You can do it with a formula. In X1 you type

=IF(A1=B1, C1, "")

And you copy down as far as necessary.

Does this help?
Kostis Vezerides
 
Does it have to be a macro? You could just put an IF statement into column
X, that says =if(exact(A1,B1),C1,""). Copy/paste the formula down. Then
autofilter or advanced filter the results.
 
In cell X1 put

=IF(A1=B1,C1,[whatever happens if A1 and B1 are not the same]

copy down as needed
 
Sub CTOX()
Application.ScreenUpdating = False
Range("A1").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(0, 1).Value Then
ActiveCell.Offset(0, 23).Value = ActiveCell.Offset(0, 2).Value
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("A1").Select
Application.ScreenUpdating = True
End Sub

This is if all 5000 in the column A are together with no breaks, it can be
adjusted to suit if there are breaks.

R
Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top