+ Reply to Thread
Results 1 to 3 of 3

VBA to copy data to a template file then save it as a new file.

  1. #1
    Registered User
    Join Date
    09-09-2013
    Location
    MAL
    MS-Off Ver
    Excel 2007
    Posts
    22

    VBA to copy data to a template file then save it as a new file.

    Hi, I'm new to this forum. I'm hoping to get some help here to automate the work that I have to do every 2 weeks.

    I'm using Excel 2007. There are 2 files.

    File A: This file is generated every 2 weeks. The data I want from this file is in Col B. Number of rows depending on transaction volume of that week. So minimum row could be 1, but so far never exceed 300 rows. It could be more in the future.

    File B: It's a template file, many fixed data in this file. Only 3 cells need changes. The 3 cells are Row 2 of Col B, C and F. All 3 cells will have the same data/value I opy from File A.

    This is what I want to do:

    1. Open File A, copy data/value in Col B, Row 2.
    2. Open File B (template), paste the data to Row 2 of Col B, C and F.
    3. Save File B as new file, in a destinated folder e.g. "Books". New filename to use the exact value I copy from File A. E.g., if the value is "Books - ANA", then the filename will be "Books - ANA.xls".
    4. Repeat step 1. Copy data in Col B, Row 3 in File A.
    5. Repeat step 2.
    6. Repeat step 3.
    7. Repeat step 1. If there's no data in Col B, Row 4 in File A, stop the process.

    Thank you.
    Last edited by Efjoker; 09-12-2013 at 11:10 PM.

  2. #2
    Registered User
    Join Date
    09-09-2013
    Location
    MAL
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: VBA to copy data to a template file then save it as a new file.

    A great person helped me figure out how to do this. So I just want to share it here. Hopefully somebody will find it useful.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-24-2015
    Location
    Emsworth, England
    MS-Off Ver
    2019
    Posts
    27

    Question Re: VBA to copy data to a template file then save it as a new file.

    I have adapted this brilliant code, I do however have a question: is there away to get a hyperlink created within the following code. I have attempted it in Range G3 but to no avail.
    Please Login or Register  to view this content.
    Hoping somebody can help.
    Last edited by CDexel2011; 12-20-2019 at 12:14 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 09-05-2013, 02:39 PM
  2. [SOLVED] Copy row from active file to another formated excell file and save as one cell value
    By snsuvarna in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2013, 04:18 AM
  3. Replies: 5
    Last Post: 05-08-2013, 06:23 AM
  4. [SOLVED] Copy two page from doc file and save in new doc file with excel creteria.
    By visha_1984 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-25-2013, 08:21 AM
  5. How to: Open file, format data, save file, close file and repeat.
    By thexeber in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2010, 12:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1