Copy values from one workbook to a another specific workbook based off a cell value

thechad

Board Regular
Joined
Apr 28, 2014
Messages
118
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Greetings,

I would like to create a macro that will copy and paste specific values from one workbook into specific cells in another workbook with some complications (for me anyway!). Here is what I have in mind:

Example Source Workbook
COLUMN A: EMPLOYEE # COLUMN B: QUARTERCOLUMN C: KPI 1COLUMN D: KPI 2COLUMN E: KPI 3COLUMN F: KPI 4
1414Q152697519
1414Q265851674
1414Q368951247
1414Q445826418

Example Receiving Workbook (will be open at time macro is run):
Condition #1: If Column A row Employee # = 1414 AND corresponding Column B cell = Q1 then paste corresponding values from above into the corresponding Employee # (i.e. 1414) workbook and the following cells:
KPI 1 = CELL B5KPI 2 = CELL B7KPI 3 = CELL B9KPI 4 = CELL B11
52697519

Condition #2: If Column A row Employee # = 1414 AND corresponding Column B cell = Q2 then paste corresponding values from above into the corresponding Employee # (i.e. 1414) workbook and the following cells:
KPI 1 = CELL D5KPI 2 = CELL D7KPI 3 = CELL D9KPI 4 = CELL D11
65851674

Condition #3: If Column A row Employee # = 1414 AND corresponding Column B cell = Q3 then paste corresponding values from above into the corresponding Employee # (i.e. 1414) workbook and the following cells:
KPI 1 = CELL F5KPI 1 = CELL F7KPI 1 = CELL F9KPI 1 = CELL F11
68951247

Condition #4: If Column A row Employee # = 1414 AND corresponding Column B cell = Q4 then paste corresponding values from above into the corresponding Employee # (i.e. 1414) workbook and the following cells:
KPI 1 = CELL H5KPI 1 = CELL H7KPI 1 = CELL H9KPI 1 = CELL H11
45826418

There won't be mixed data from multiple quarters in the Example Source Workbook above on the same worksheet...it will just be rows of data with no special formatting and will be one quarter at a time. There will be 4 worksheets, each representing a quarter of their own. When I run the macro, it can be the same coding that will run on whichever quarter's worksheet I have activated at the time.

Each Employee # in the Example Source Workbook will have a corresponding workbook, each with 4 quarters, that will be open prior to running the macro. When I run the macro, the values for each Employee # in the corresponding row should be transferred to the corresponding workbook and cells as shown in the Example Receiving Workbook above. If the macro is able to go through each Employee # using one button that would be ideal as opposed to having to run a macro for each Employee #. If by chance there was an Employee # in the Example Source Workbook but no open corresponding Excel file with the same Employee # I would like the macro to stop running and provide an error message indicating that has occurred.

This is way above my ability and I hope it's not too complicated to make this happen.

Thanks in advance,
Chad
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi all...I know it's not best practices to repost something however I am wondering if anyone can provide some assistance with this ask.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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