+ Reply to Thread
Results 1 to 6 of 6

vba script to generate files based on an data from an Excel sheet

  1. #1
    Registered User
    Join Date
    10-29-2007
    Posts
    12

    vba script to generate files based on an data from an Excel sheet

    Hi guys,

    I've got an Excel sheet with approximately 2,000 file names (all csv files) stored in the first column. I will call this sheet files.xls. I want to create a macro which does the following:
    Step 1. Open a file called template.xls. This sheet contains all the formatting and some VBA code.
    Step 2. In template.xls ... import the first file (e.g. a.csv) mentioned in the list of files listed in the first column in files.xls.
    Step 3. Save template.xls with the imported data from a.csv as a new file called a.xls.
    Repeat this for all the files in files.xls

    Can someone help me write this vba script ? I'm a complete newbie in vba but I really need this script to save lots of time.

    Thanks,
    Bananas
    Last edited by VBA Noob; 10-29-2007 at 06:38 PM.

  2. #2
    Registered User
    Join Date
    10-29-2007
    Posts
    12
    some feedback please ?

  3. #3
    Registered User
    Join Date
    10-29-2007
    Posts
    12
    Is there someone who can give me at least a hint ... how can I start with the script ?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Add this code to a workbook in the directory where the csv files are located.
    Please Login or Register  to view this content.
    Last edited by shg; 10-30-2007 at 12:47 PM.

  5. #5
    Registered User
    Join Date
    10-29-2007
    Posts
    12
    Hi Shg,

    Thank you very much for the script. Is it possible to adapt the script and let it work with an 'import data' instead of a copy/paste of the data ?

    Thanks again, you are going to save me lots of time
    Bananas

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    bananas, I'll let you press on from here with help from others.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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