Copy cell value to another cell

I need to automate the copying and pasting of values from column F into their respective columns based on the codes in column A.

We have a set list of codes that relate to each of the headings in columns J:N (FRAME LABOUR      SHEET LABOUR      SET LABOUR      INSO LABOUR      MISC LABOUR)

I need the vba code to do the following:
If a value in column a = 'Frame Labour Code' copy value from column F to column J (within the same row)
Else if a value in column a = 'Sheet Labour code' copy value from column F to column K
Else if a value in column a = 'set labour code' copy value from column F to column L
Else if a value in column a = 'Inso Labour code' copy value from column F to column M
Else if a value in column a - 'misc labour code' copy value from column F to column N

It would be useful if I could have the codes stored on a separate sheet in excel and then look to them so that the codes can be updated by anyone.

Thank you in advance
RobJanineAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wilder1626Commented:
Hi

Is that what you are looking for?
Private Sub CommandButton1_Click()
Dim col1, col2, col3, col4, col5, col6, col7, startRow As Integer
Dim cell As Range

col1 = 1 'column A
col2 = 6 'column F

col3 = 10 'column J
col4 = 11 'column K
col5 = 12 'column L
col6 = 13 'column M
col7 = 14 'column N
startRow = 2

For Each cell In Range(Cells(startRow, col1), Cells(Rows.Count, col1).End(xlUp))
    If Cells(cell.Row, col1) = "Frame Labour Code" Then Cells(cell.Row, col3) = Cells(cell.Row, col2)
    If Cells(cell.Row, col1) = "Sheet Labour code" Then Cells(cell.Row, col4) = Cells(cell.Row, col2)
    If Cells(cell.Row, col1) = "Set labour code" Then Cells(cell.Row, col5) = Cells(cell.Row, col2)
    If Cells(cell.Row, col1) = "Inso Labour code" Then Cells(cell.Row, col6) = Cells(cell.Row, col2)
    If Cells(cell.Row, col1) = "Misc labour code" Then Cells(cell.Row, col7) = Cells(cell.Row, col2)
Next
End Sub

Open in new window

RobJanineAuthor Commented:
Sorry I didn't explain the codes very well, there are multiple codes for each of those headings, please see attached excel workbook.
If Cell A3 is code LC03 or any other code in the Frame Labour Code, the value assigned to it in column F would be copied to Column J.
Thanks for your help
vba-test.xlsx
Ramesh VCommented:
Hi,
Please test the attached file:
How to test:
1. Save the workbook
2. Click on the button in sheet 1
3. A message appears when process is completed.
Note: I've created named ranges in Codes sheet.
Don't remove the named ranges in column A,B,C,D and E of Codes sheet
Also the code is dynamic, if you update your list, it'll take care.
Capture.JPG

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Ramesh VCommented:
Please test the attached...vba-test.xlsm
RobJanineAuthor Commented:
Thank you so much for your help that worked perfectly.
Ramesh VCommented:
You are welcome
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.