+ Reply to Thread
Results 1 to 3 of 3

Create multiple new files with names taken from another workbook

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Ma. USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Create multiple new files with names taken from another workbook

    Budget time and I need to create many new files for all the region and departments. To save a lot of time I have created some macros that uses a GENERIC file, pulls the COMPANY, DEPARTMENT and DEPT_NAME from the first row of data in the MAIN file, adds some calculations and data and then saves and closes the new file using the COMPANY and DEPARTMENT to name the file and then opens the GENERIC file ready to do it again with the next line of data in the MAIN file. THis all works fine up to now. My problem is I need to automate the process of doing this repeatedly until all the rows in the MAIN file have been used. I need a loop process or something that knows to pull the next row of data from the MAIN file each time the last file is saved and closed.

    I need a macro that runs the loop, calls the macro (CREATE_NEWFILE) which does all the processing as described above, and then moves to the next row in MAIN and passes that row number to CREATE_NEWFILE so it knows which row to pull the data from. I also need to know how to incorporate the new row number into the CREATE_NEWFILE. Here is the code that pulls the data from MAIN into GENERIC but it does not pull the correct rows. I attempted to feed the variable ROW from a loop process into the formula but neither was successful.

    I hope I have explained the situation clearly.

    Please Login or Register  to view this content.
    Came at it another way and found the simple solution!
    I have updated the code above to reflect the changes that made it work.
    Last edited by KCK01; 10-12-2012 at 03:25 PM.

  2. #2
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,160

    Re: Create multiple new files with names taken from another workbook

    Thank you for providing the solution.

    However, it would have been good if you left the original post intact and provided your solution in post 2 of this thread. That way, other users can easily understand the before and after scenarios of your issue.

    Maybe you can do so next time.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    Ma. USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Create multiple new files with names taken from another workbook

    Thanks for the feedback and excellent suggestion arlu1201. Will do next time.

+ 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