+ Reply to Thread
Results 1 to 13 of 13

VBA Code to save to a folder within a folder within a folder all based on cell values.

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    VBA Code to save to a folder within a folder within a folder all based on cell values.

    Hi All

    This might be basic but is it possible to save a file into a folder within a folder within a folder based on Cell values.
    What I want to do is save as the following:

    Save Worksheet Name in Folder ActiveSheet.Range("E6") within Folder ActiveSheet.Range("E5")

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,788

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    To get you started.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    hi bakerman2

    What I have is the following code giving a 1004 runtime error.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,815

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Make sure of the path
    Please Login or Register  to view this content.
    Can you mention what the values are in the cells mentioned in the code? I think the problem is related to the path as I tested the code and it works well for me
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Hi YasserKhalil

    Thanks for input. Values are as follows:

    D5 = "Week"
    E5 = "1"
    E6 = "July 2016"

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,815

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Try not to type directly "July 2016" in E6 .. Try typing it but put apostrophe before the string (to deal with it as text)
    In E6 type
    Please Login or Register  to view this content.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Tried .... To no avail. The cell is populated from a textbox

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Hi All

    I have tried changing the cell values to almost anything and still get error code

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,815

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Can you upload sample workbook?

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Here you go
    Attached Files Attached Files

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,788

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    Test this.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 07-24-2016 at 05:56 AM.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,691

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    bakerman2...

    That works like a charm.....What, how.

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,788

    Re: VBA Code to save to a folder within a folder within a folder all based on cell values.

    You're welcome and thanks for the rep points.

+ 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. Need help with code to save file in a folder location based on a cell value
    By msantucci in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2015, 05:56 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] Save File to folder Where folder is referenced in cell
    By Will_iam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2013, 08:35 AM
  4. Code to create New Folder (if doesn't exist) and then Save Workbook to folder
    By jenhawley in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-10-2013, 03:09 PM
  5. [SOLVED] Create a new folder based on a cell name or value and save copy onto that folder
    By Le_Tiago in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-20-2012, 01:33 PM
  6. Replies: 6
    Last Post: 08-11-2006, 03:41 PM
  7. [SOLVED] Need code to save file to new folder, erase from old folder
    By Ron M. in forum Excel General
    Replies: 1
    Last Post: 02-24-2006, 02:10 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