Copy/Paste Macro from Sheet2 to Sheet1 based on on another column values

Status
Not open for further replies.

Amarben

New Member
Joined
Nov 1, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi all, first off thank you in advance for reading and considering to help.

I am looking for assistance on a copy paste macro to copy data from Sheet2 to Sheet1.

the macro must Compare the values of columns C in the 2 sheets and if they are equal: copy/paste the whole row in sheet2

Example: If Sheets(2).rows("C4").Value is equal to Sheets(1).rows("C7").Value then copy/paste data from row 4 of sheet2 (Source) into row 7 of sheet 1 (Destination).

If a value in column C of sheet2 does not exist in sheet1 THEN add a new compatible row at the bottom in sheet1 (add the row of the value that does not exist in sheet1).

Below is a visual representation of what i'm looking for:

That's Sheet1 (SOURCE), Culumn C (Project Code is a unique value)

Capture1.PNG

And This is Sheet2 (Destination), with the same culumns and format

Capture.PNG

After Running the Macro,
the rows of Sheet1 (Destination) having the same values as column C (Project CODE) of Sheet2 (Source) will be updated (values replaced).
If a value of Column C (Project code) does not exist in sheet1, then add a whole row at the bottom / As in the example below

Capture3.PNG

I have been struggling with this task for a few days, I tried some manipulation and I didn't find the right solution, I would be grateful for your help
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Status
Not open for further replies.

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top