Excel/Need to include



I'm looking at creating a fairly basic macro which clears data from certain table within a file, before saving as a new file, which will be used the following days.

Ideally, the "save as" will include "todays date" at the suffix. If this isn't possible, I am happy for the user to enter the file name, presuming the macro goes as far as finding the folder within the relevant drive.

Thanks in advance

ANSWER: So, what's your question?

---------- FOLLOW-UP ----------

QUESTION: Sorry, that wasn't clear at all.

Can you tell me what code I should use for the 'Save as' part of the macro, so that the name is dynamic, changing the date suffix each time it run

No problem.  I need to know:
1. what the file name is WITHOUT the date part of the name
2. HOW the date that is part of the file name is to be formatted
3. if the file will be saved more than once in a day then how should the file be named
4. if the path is always the same and if so what is that path so I can include it in the code
5. If the file is saved more than once in a given day should it be replaced



I also need to know HOW you want the user to run the macro which determines where it needs to be placed, either in the Personal workbook on each PC that needs to have access to run the macro, or in each data workbook which means it can be run automatically on its own when the workbook is closed.

If the path will be variable I can have the user be prompted to navigate explorer and select any file in the folder where the file will be saved and then save the flle in that selected folder if that will help.

As with all macros there are details, details, details.

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts




I can provide help with most all EXCEL questions and most all questions about writing EXCEL macros. I have been developing macros for about 10 years in EXCEL and have switched to it from Lotus 1-2-3 after about 10 years of writing macros in it. Typically, I will not write a macro for you unless it is very short because of all the details a macro has to know about to work every time and all the time are rarely provided. If I am not given ALL the details, circumstances, and situations then a "good" macro can not be written. Please understand that I do not know it all and will be the first to say so. As politely as possible, I don't write macros for people on this site who need one, want one, seem to imply that they need one, and/or seem to think I am expected to write one UNLESS they are very short, quick, and simple. 99% of all macros are more involved than what you think and rarely am I provided with enough specific and complete details to have the code work the first time and every time. This typically means too many follow-up emails, and subsequent macro changes due to lack of specific details, just to get those details so that the macro would work, all of which is on my own free time. The voice of experience from responding to many questions from people who ask me to write a macro for them from this site tells me this. I don't mean to come across as unhelpful but macros are usually very specific and without ALL of the specifics the macro I would write will not address all of your needs and the layout, location, formatting, conditions, etc. of your data and any related files the macro would have to work with. What seems like a simple task to you is almost always more involved than what you think to have the macro ALWAYS work in EVERY situation. If you have a macro you have already written and have a question about it then perhaps I could help with that. I am sure and hope you can and do understand.

©2017 About.com. All rights reserved.