+ Reply to Thread
Results 1 to 10 of 10

Help/Assistance/Guidance in "tidying" up code used to generate multiple folders and files

  1. #1
    Registered User
    Join Date
    11-18-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2010
    Posts
    5

    Help/Assistance/Guidance in "tidying" up code used to generate multiple folders and files

    Hi All,

    I was wondering if anyone might be able to offer some tips/assistance on how I could tidy up the following. I may be too much of a perfectionist but I feel like this could be a lot tidier, although it works perfectly well. I'm trying to learn as I go so feedback would be greatly appreciated.

    Please Login or Register  to view this content.
    Last edited by gclark81; 11-19-2013 at 06:03 AM.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Newby seeking help with messy VBA

    I'm a bit lost as to how your code works - Filename2.xls is saved as another name and then on the next loop it would no longer exist and you would get an error when you try to activate it?

  3. #3
    Registered User
    Join Date
    11-18-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newby seeking help with messy VBA

    Filename1 contains a list of names and other parameters, the code copies this name and updates a cell in filename2. I then use ".calculate" to refresh filename2 which uses vlookups to refer to the parameters in filename1, thus overwriting the original document. Filename2 is then saved in a new directory using the name copied over from filename1.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Newby seeking help with messy VBA

    So on the second run through of the loop, filename2 no longer exists, as it has been saved with a new name, which will create an error?

  5. #5
    Registered User
    Join Date
    11-18-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newby seeking help with messy VBA

    No, the "Workbooks.Open Filename:=strBasis, UpdateLinks:=0" code reopens filename2 to allow the code to input the next name on the list and produce the next new spreadsheet.

    The reason for producing this code was to take the manual aspect out of creating 100+ seperate spreasheets all in seperate folders.

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Newby seeking help with messy VBA

    strBasis is a file called "Jun13_base_AssumptionsTemplate_Assumptions.xls". Not "filename2.xls"...

    It might be better if you upload the actual code you are using???

  7. #7
    Registered User
    Join Date
    11-18-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newby seeking help with messy VBA

    Updated above

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Newby seeking help with messy VBA

    perhaps:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-18-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Help/Assistance/Guidance in "tidying" up code used to generate multiple folders and fi

    Thanks for the reply, I get a run time error 13 - type mismatch with that though. It occurs on the "Set wb1 = Windows("WPSF Run Specification June 2013_ICA_RiskAgility2.xlsm")" line.

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Help/Assistance/Guidance in "tidying" up code used to generate multiple folders and fi

    Maybe
    Please Login or Register  to view this content.
    then?

+ 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. newby
    By andyco11 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-01-2013, 10:47 PM
  2. Newby
    By CFritz7 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 06-27-2013, 10:28 AM
  3. newby
    By Phil McDowell in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 06-02-2012, 12:12 AM
  4. Newby
    By AnnChum in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-02-2012, 09:23 PM
  5. Newby help
    By Dave-Excel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2006, 06:50 AM

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