If the data in sheet 1 matches the data in sheet 2, then copy the data of a different cell in sheet 2 to sheet 1

FariAb

New Member
Joined
Jul 20, 2022
Messages
13
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi everyone! I have 2 sheets, the first one looks like this:
DatesDate 1Date 2Date 3
Demand123
And the second one looks like this:
Demand
Random info
Random info
Cost
1x
x
$15
2
x
x$26
3
x
x$37

I'd like to have a macro that copies the costs of sheet 2 to sheet 1 if the demand matches. I am aware that this could be done via an Excel formula, but there is an array of "sheet 2" sheets, it isn't the same one every time the macro will run. I have the macro to change the sheets based on the demand you want to get, only the copying and pasting part isn't working.

Does anyone know how this could be solved?

Thank you in advance.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

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