+ Reply to Thread
Results 1 to 2 of 2

Save copy of file in folder hierarchy for each dropdown value

  1. #1
    Registered User
    Join Date
    12-27-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Save copy of file in folder hierarchy for each dropdown value

    I have an Excel sheet designed to spit out payroll details. The numbers on the sheet are driven by a data validation dropdown in A2, which fills in B2:G2 with identifying information (Last, First, Region, Hospital, PayPeriod, Year) pulled from a data tab.

    What I'd like to do is have a macro save a copy of the sheet for each choice in the dropdown into a specific folder in a hierarchy based on the info in B2:G2.

    For instance,

    Please Login or Register  to view this content.
    I'd like that to save a sheet named "2016_PP1_DC_VN_Smith_Scott.xlsx" in the folder Root\2016\PP1\DC\VN\.

    And then change to

    Please Login or Register  to view this content.
    And save the sheet "2015_PP3_NY_RV_Jones_Karen.xlsx" in the folder Root\2015\PP3\NY\RV\.

    I have a macro that's part of the way there. It goes through each drop down and saves the file with the correct filename (Though it's renaming the initial file) I need help adding the functionality to save the sheets in a hierarchy of folders and not overwrite the original document with the most recent saved sheet name.

    Totally fine with continuing to use this macro with edits or start from scratch.

    Please Login or Register  to view this content.

    Thank you guys for the help! If you're feeling verbose, it would be great to have some details in your response so I can learn.
    Last edited by Gondi; 09-15-2016 at 03:56 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Save copy of file in folder hierarchy for each dropdown value

    My suggestions. I've added a second macro "MakeFolders" that is used to insure the folders exist in the created RelativePath string.

    Be sure to EDIT the start the RelativePath so it begins in the correct place. I set it to "C:\Root\"

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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. How do I convert column hierarchy to flat file hierarchy
    By tbucki1 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 09-21-2016, 09:33 PM
  2. [SOLVED] Lookup folder from cell text, then save excel file in this folder
    By dodgybob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2014, 09:00 AM
  3. [SOLVED] User input to select file and save copy in hidden folder
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2013, 10:24 AM
  4. Save copy of file in other folder
    By lfmemp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-06-2012, 03:37 PM
  5. Save a file to a folder, create folder if it doesn't exist
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2010, 09:12 AM
  6. Create Folder with system date then save file to folder
    By cartotech81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2009, 02:12 PM
  7. Replies: 6
    Last Post: 08-11-2006, 03:41 PM

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