Copy row values from one worksheet in one workbook to multiple workbooks based on file name

thechad

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

I am trying to build a macro that will allow me to copy row values in columns B - I from one workbook (Master) into a another workbook for each File Name listed in Column A into a corresponding workbook with the same file name that will be open at the time. The ranges the values will be copied to in the corresponding workbooks will always be the same...it will be the file names that may vary depending on circumstances.

A
B
C
D
E
F
G
H
I
1
FILE NAME
VALUE 1
VALUE 2
VALUE 3
VALUE 4
VALUE 5
VALUE 6
VALUE 7
VALUE 8
2
8741020304050607080
3
9211122334455667788

Here is the beginning of some code that I have however I do not have the knowledge to generate a macro that goes through each value in the File Name column above and copies the corresponding row values to the matching workbook. The # of values in the File Name column would not exceed 50 rows if that makes a difference or not.

Excel Formula:
Sub copytoanotherwb()

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("B1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("J56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("C1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("K56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("D1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("L56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("E1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("M56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("F1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("J61").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("G1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("K61").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("H1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("M61").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("I1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("J65").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("J1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("L65").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("K1").Copy
Workbooks("874.xlsx").Worksheets("MATRIX CALCULATOR").Range("M65").PasteSpecial Paste:=xlPasteValues



Workbooks("Master.xlsm").Worksheets("Sheet1").Range("B2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("J56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("C2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("K56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("D2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("L56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("E2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("M56").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("F2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("J61").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("G2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("K61").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("H2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("M61").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("I2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("J65").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("J2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("L65").PasteSpecial Paste:=xlPasteValues

Workbooks("Master.xlsm").Worksheets("Sheet1").Range("K2").Copy
Workbooks("921.xlsx").Worksheets("MATRIX CALCULATOR").Range("M65").PasteSpecial Paste:=xlPasteValues

End Sub


Thanks in advance for any assistance.

Chad
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,073
Messages
6,122,977
Members
449,095
Latest member
Mr Hughes

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