+ Reply to Thread
Results 1 to 2 of 2

Button to save workbook, with value in specific cell (H5), in a specific folder

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    oslo
    MS-Off Ver
    Excel 2003
    Posts
    1

    Red face Button to save workbook, with value in specific cell (H5), in a specific folder

    Hello,
    My name is Jonas, and my first post here.. I'm trying to learn more Excel, so happy to be here with so many knowledgeable people.

    I'm trying to make an overtime sheet for my job... In the H4 cell I have the date in the format Feb. 2014 (but filled in with 2.14) ... There I want to fill in the date for each month
    when I make my overtime sheet to send to my manager... I want to make a macro function that each time I have populated my monthly overtime sheet, I click a "save button" and it saves a copy of that monthly overtime sheet to a folder called "saved lists" that will be placed in a folder "overtime" in my desktop. The name of the saved file has to be the value in H4.xlsm, and the next months file has to change according to the value in H4... In the "overtime" folder I want to have the main overtime file which I will use/open each month and populate, click the "save button" (I mean a macro button in the excel sheet, and not normal excel save), and have it save that months overtime list in the folder "saved lists" with the name of the corresponding month as given by H4..

    In short, I want a macro that helps me populate my overtime hours, and be able to click "save" and have it make a copy of each months overtime list in the folder as explained above..

    The file I've made can be downloaded here - https://dl.dropboxusercontent.com/u/.../Overtime.xlsm --- if you can/have time pls. change it for me and send to [email protected] and also just paste your changes so other people can learn ... Here the macro as I have it now... Now it saves the file in C:\Users\Jonas\Documents\Saved overtime lists with the name 01.02 (for 1st of feb.) instead of the value as given in H4 which is Feb. 2014

    Sub Save_wrkbk()
    Dim strFilename, strDirname, strPathname, strDefpath As String
    strDirname = "Saved overtime lists"

    strFilename = Range("H4").Value
    strDefpath = CreateObject("WScript.Shell").SpecialFolders("MyDocuments") & "\"
    If IsEmpty(strFilename) Then Exit Sub

    MkDir strDefpath & strDirname
    strPathname = strDefpath & strDirname & "\" & strFilename

    ActiveWorkbook.SaveAs Filename:=strPathname, _
    FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=False, CreateBackup:=False
    End Sub



    Thanks in advance !!!

  2. #2
    Registered User
    Join Date
    03-19-2014
    Location
    India
    MS-Off Ver
    Excel & VBA - 2007 & 2010
    Posts
    60

    Re: Button to save workbook, with value in specific cell (H5), in a specific folder

    Hi,

    As you are New to forum, this is to inform you that next time if you add any codes to the post. Kindly add it in special function added in the post tools (the sign is of #)

    Please find the updated code.

    Please Login or Register  to view this content.

    Thanks!
    Moinuddin Shaikh

    If you like my Response:
    1. Show appreciation to those who have helped you by clicking "* Add Reputation" below their posts.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    Appreciate someone towards their career path is better than saying Thanks!
    -Moin

+ 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 to save a same workbook with different name in specific folder
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2014, 11:42 PM
  2. Create New workbook and save it in specific folder for each row inserted.
    By yrk2k8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2013, 02:15 AM
  3. [SOLVED] Macro to save workbook to specific folder with a specific name, then kill/disable itself.
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2012, 03:50 PM
  4. Macro to save a workbook to a specific folder
    By Keith24249 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2012, 02:59 PM
  5. Replies: 1
    Last Post: 06-02-2006, 06:35 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