+ Reply to Thread
Results 1 to 3 of 3

Macro to save workbook - Create Directories / Sub-Directories Based using text in cells

  1. #1
    Registered User
    Join Date
    11-20-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Excel 2010
    Posts
    64

    Talking Macro to save workbook - Create Directories / Sub-Directories Based using text in cells

    I have very limited knowledge of VBA, but haven't been able to find code examples of exactly what I want.

    I have a workbook with a worksheet named "Data Sheet." Multiple users will open up a read only version of the workbook, enter some data on the "Data Sheet," and then hit a Macro Button that should:

    Check to see if a Directory & Sub-Directory exists (I really don't need to know, just trying to avoid errors),
    If not, create the applicable directories and save the workbook in the directory.

    I will have the following Cells contain text to be used for the directory and file names:

    T40 = File Name (e.g., Japan 01-20-2014 John Smith)
    T41 = Directory (e.g., FY14) "Fiscal Year"
    T42 = Sub-Directory Name (e.g., Japan)

    So, if my hard drive just has the directory G:\Everyone\Travel Unit\Foreign Travel\

    I want to run the macro and it would ultimately save the file as G:\Everyone\Travel Unit\Foreign Travel\T41\T42\T40.xlsm
    or G:\Everyone\Travel Unit\Foreign Travel\FY14\Japan\Japan 01-20-2014 John Smith.xlsm

    If found some pre-code that looks like I should stick in front of it to ensure that certain cells have been filled with data before saving. That is:

    Please Login or Register  to view this content.
    Any help would be greatly appreciated..
    Last edited by kspeese; 01-03-2014 at 05:06 PM.

  2. #2
    Registered User
    Join Date
    11-20-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Macro to save workbook - Create Directories / Sub-Directories Based using text in cell

    I found some code that I got to work by creating the named paths in my Data Sheet, but I'm having problems trying to integrate the code I 1st listed that basically checks for a condition to be met, before allowing the rest of the Macro to run. Can anyone help?

    Here's the code I got to work (Looks like a Bill Rockenbach should be credited):

    Please Login or Register  to view this content.
    So, I need to somehow integrate the below formula into the 1st part of the Macro to tell it to continue or stop and list the message box:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-20-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Macro to save workbook - Create Directories / Sub-Directories Based using text in cell

    I figured it out:

    Please Login or Register  to view this content.

+ 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. VBA Create directories for each row one at a time
    By porculator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2013, 01:36 PM
  2. How to create multiple directories from cells using a macro or VBA
    By riskmgr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 10:16 AM
  3. Create Nested Directories
    By dgkindy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2008, 10:06 AM
  4. [SOLVED] Create list from directories
    By SoloGIS in forum Excel General
    Replies: 1
    Last Post: 11-22-2005, 05:10 AM
  5. [SOLVED] Create Windows Directories from column entries?
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 07:05 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