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.
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.
"abmb161" wrote:
> 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.
In cell Z1 enter:
=IF(A1=B1,C1,"")
and then copy down
--
Gary's Student
"abmb161" wrote:
> 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.
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
--
(][ THIS EMAIL HAS BEEN SCANNED BY NORTON ANTIVIRUS ][)
"abmb161" <[email protected]> wrote in message
news:[email protected]...
>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.
I have kind of a similar question so no need to create a new topic.
I'm not looking for a formula, but for a macro.
I kind of need a "if column A equals B, then C is 0".
Rows A and B are completely different, but B and C are related.
Example:
A / B / C
10 10 1
20 30 1
30 40 1
50 60 1
In this case 10 and 30 should get a zero in column C.
A / B / C
10 10 0
20 30 0
30 40 1
50 60 1
edit: It would be great if someone could help me out!
Last edited by hayman; 02-04-2014 at 04:39 PM.
hayman,
Welcome to the forum.
Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks