Avatar of Mezczyzna
Flag for Canada

asked on 

Copy part of cell (in Edit mode), to a different cell in a loop macro.


Looking for idea to write a macro replacing the first three characters currently sitting in the ERP column.

PartId   Number      ERP
Oct-35      414825      01-10-3035
Oct-60      423957      01-10-3060
Oct-92      508694      01-10-3292
Oct-95      509789      03-05-2018
Oct-12      515998      01-10-3312
Oct-43      527320      01-10-3343

The above data comes from our ERP as csv file and shows date in the PartID columns on 6,600 parts out of 30K. It is formatted as date and the Number column shows what is the value for the date. The data in cell however looks like the one in column ERP.
When you click F2 remove the first 3 characters, enter ' to mark it a text and enter key, it properly shows part ID as 10-3035.

I tried to write a macro replacing three rows to use in a loop, but it enters hard coded Part ID.
Then I tried to press F2 - Copy the right seven characters, but it enter hard coded Part ID again.

What I need it to copy and paste the actual changing part ID.

Any idea how can I do that?

The right() function doesn't work because it the number.

Your help is greatly appreciated.
Thank you.
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Jacques Geday

8/22/2022 - Mon