+ Reply to Thread
Results 1 to 7 of 7

Save as cell contents & date on close

  1. #1
    Registered User
    Join Date
    11-25-2015
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    12

    Save as cell contents & date on close

    Hello! Sorry if this has been posted before but I can't find an answer.

    Okay so I want a macro to save as a workbook when you close it with the filename of cell contents (B4) and today's date. Also I am pretty much completely new to VBA so I don't even know where to start. I know how to get into the editor that's about it .

    Thanks

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Save as cell contents & date on close

    Do you mean save a copy of the workbook and discard the changes in the original?

    What sheet is the B4 on that you want as part of the file name?

    What does B4 contain? Text? Number? Special characters?

    BSB

  3. #3
    Registered User
    Join Date
    11-25-2015
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    12

    Re: Save as cell contents & date on close

    Yes, sorry I wasn't more clear. I want to save the file as a new file and discard any changes from the original. It's just on sheet 1? And it consists of a concatenate formula from several different cells on the sheet, text and numbers.

    Thanks

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Save as cell contents & date on close

    Sorry for the delay. Got distracted by something edible!

    Have a look at the attached. You'll have to amend the code slightly to take account of your desired save location.
    To do this:
    1. Open the workbook
    2. Press Alt+F11 (to open the VB Editor)
    3. Double click where it says "ThisWorkbook" (shoudl be near the top left corner of the VBE)
    4. Amend the line with "G:\My Documents\" to your desired path
    5. Close the VBE
    6. Exit the file

    Is that any use to you?

    BSB
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-25-2015
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    12

    Re: Save as cell contents & date on close

    Yes! This worked. Thank you very much. Sorry I should have mentioned this at the start but is there a way for me to save the new file as non-macro enabled document? I tried changing the file type to .xlsx but got an error.

    Thanks

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Save as cell contents & date on close

    Try this version.

    BSB
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-25-2015
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    12

    Re: Save as cell contents & date on close

    Thanks!

+ 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. [SOLVED] Having a problem with Save/Close after a certain date macro
    By Malik Demirel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-20-2015, 05:54 AM
  2. [SOLVED] Macro to save file - save name from cell containing a date using different date formatting
    By d_max_c in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2014, 12:18 PM
  3. [SOLVED] Save data to cell on close workbook event not working
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-28-2014, 12:52 PM
  4. Replies: 2
    Last Post: 04-10-2014, 07:06 AM
  5. Replies: 1
    Last Post: 10-25-2013, 06:10 PM
  6. Save AS file name as cell contents
    By Anonbrumbie in forum Excel General
    Replies: 10
    Last Post: 10-08-2009, 12:06 PM
  7. How to save contents of a cell into a string
    By help000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2007, 10:46 AM

Tags for this Thread

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