There are plenty of code examples on this forum but best of all to start with.
Open Excel
Tools,Macro,record new macro
give it a name etc.
enter some data in a cell, save the work book, stop the macro recorder, Tools,Macro,macros,highlight your macro],Edit and look at the code.
try creating a footer containing the filename and date and see what that macro looks like.
etc. etc.