I have a macro in a master file which opens other smaller files and copies their data, it then moves these smaller files into a 'Done' folder with the current date and time appended to the file name.
Currently I have declared my DateTime variable at the start of the code before my For Each loop gets to work on the files. This means that the the same Time (hhmmss) is appended to each file. Now I assume I could just rearrange the code so the declaration is inside the loop so the Time variable (or at least the seconds) would be updated for each file, but is that the only way to get the different times on each file, or is there some sort of 'refresh' line I can add to the start of the loop that will update the variable value instead?
And on a related note, what is 'best practice' for declaring variables? Should they ideally all be declared at the start of the code or does it make no difference when or where you declare them (pending their usage obviously)?
Bookmarks