Creating Files With Unique Names With An Excel Macro

Excel macros

One of the things that I often need to do when working my spreadsheets is to save information at various times during the day. It’s important for me to keep logs of all of these files. So what can I do? I used to save files in a format such as:

TD20131015.csv

Where 2013-10-15 is the date. The problem came up when I started to need saving several files in the same day (but keeping each one). I looked at potential options.

-Saving the file manually (which is against the whole idea of using macros)
-Having a location in the file where a number is written (it could be changed from 1 to 2, to 3, etc) – the biggest problem is that it would create bugs. For example what happens if you close (without saving) and reopen the file?

In the end, I decided to simply save the file using the exact date AND time. It would look more like:

TD_20120628_094100.csv

How? It’s fairly easy. First, I created a cell in my file where I get today’s date:

Then, I created a name and finally added this simple macro:

It’s fairly simple but it works

***************************************************

Look Good at Work and Become Indispensable Become an Excel Pro and Impress Your Boss


***************************************************