saving in sequential numbering i.e 1,2 3 etc or by date/time

  • Hi there,

    Currently i have a vb statement that will copy a sheet and then save it to a certain location.

    what im interested to do is to set it up so when i click the button the first is called 1, then 2 etc.

    Also is it possible to save them as the current date and time??

    my current code is below.

    Sub savings()

    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:="C:\SCH\1.xls", FileFormat:=xlNormal, _
    Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _

    End Sub

  • Okay, first, in order to generate an incremented number, you need to find out what number you are currently using. To do this, I suggest using the "ThisWorkbook" object. In the "ThisWorkbook" object, paste the following code (or something like this):

    Okay, that takes care of the number. Now to save your new format you can paste this in any module:

  • thats great thankyou,

    do you know if it is possible to say have a series of numbers in a cell(a1)and then when you push save, it would then save it as the values in a1?

    another question... is it possible to save something as the time and date of the save?

    thanks for your help

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!