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!
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!