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.
Came at it another way and found the simple solution!Please Login or Register to view this content.
I have updated the code above to reflect the changes that made it work.
Bookmarks