Hi,
I can't see any spreadsheet pictures in your post (there is only an advertising banner) so I'm going to improvise an example.
Btw - rather than linking an image to a 3rd party site, it would be much better to attach a workbook which we can experiment with.
Anyway...
The fact that they are sorted in Customer Number order, with the new above the old, makes life much easier. Say this is your starting point:
Code:
A E
Keycode Customer Number
123 12345
234 12345
345 23456
456 45678
456 45678
678 45678
Row 1 contains the column headers "Keycode" and "Customer Number". The column letters A and E are only there as indicators, they are not on the worksheet itself.
Since you want to copy the old keycode to the new keycode, you could use an empty column to determine the correct keycode. Say column H is empty, put in this formula from the first record and copy downwards:
=IF(E2=E3,H3,A2)
It would look like this:
Code:
A E H
Keycode Customer Number Revised Keycode
123 12345 234
234 12345 234
345 23456 345
456 45678 678
456 45678 678
678 45678 678
Then you can simply copy and pastespecial values from column H into column A and clear the contents from column H. The final result would be:
Code:
A E
Keycode Customer Number
234 12345
234 12345
345 23456
678 45678
678 45678
678 45678
So that's a pretty straightforward way of achieving this. Of course you could automate the process using VBA, but if you are not familiar with VBA then I think that this is a more appropriate way for you to do it.
Hope that helps...