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!
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Watch MrExcel Video

Forum statistics

Threads
1,100,184
Messages
5,473,004
Members
406,843
Latest member
David_Welland

This Week's Hot Topics

Top