Open specified source and destination files and copy single cell value, continue until all values copied

florelix

New Member
Joined
Aug 7, 2015
Messages
8
Hey guys,

I am facing an issue where my excel knowledge comes to an end. I already have a macro to get file names from a folder and rename the files according to a New File Name.

I now have one source file that contains a column with values. I need to copy each one of the values into a specified source file - each value goes into its own file, always into cell A4.

Source file: Values in column B starting in B2 and continuing down. Amount of rows varies.

Macro file:
- Has New File Name column.
- New file names are in column B starting with the first name in B3 and continuing down.
- Number of file names vary.
- New file name contains text and the exact value that is in source file column B.

Goal:
- Marco asks user to select source file. Source file is in same folder as target files.
- Macro takes first value from source file (B2) and finds corresponding target file in same folder. Macro opens target file and copies source value into target file cell A4. Macro closes target file.
- Macro continues with next value in source file (B3) and finds corresponding target file in same folder. Macro opens target file and copies source value into target file cell A4.
- This continues until all values in source file are copied.
- If source file has a value that does not have a corresponding target file, continue with next source file value.
- Generate output of all values copied in new sheet in macro file. Column A source file value. Column B statement of "Copied" or "Error" depending on whether value was copied successfully or not.


Example values and file names:
- Source value: 12345
- Target file name: ABC 12345 8ab abcd

Thank you so much for your help with this!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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