+ Reply to Thread
Results 1 to 13 of 13

Automatically run macro at a particular time

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Automatically run macro at a particular time

    Hi..

    Put this in a Module..
    Sub Saveas()
    Dim ShNames As Variant
    ShNames = Array("Sheet1", "Sheet2", "Sheet3")
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    Sheets("Sheet1").Range("B4:B12").Copy Destination:=Sheets("Sheet2").Range("B4")
    Set NewWkbk = Workbooks.Add
            ThisWorkbook.Sheets("Sheet2").Copy Before:=NewWkbk.Sheets(1)
            NewWkbk.Sheets(1).Name = "Data"
            Worksheets(ShNames).Delete
            NewWkbk.Saveas ThisWorkbook.Path & "\" & Format(Now, "long date")
            NewWkbk.Close
    
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    End Sub
    And add this to your Sheet code to call it at 4:15 AM..
    Private Sub Worksheet_Activate()
    Application.OnTime TimeValue("04:15:00"), "Saveas", Schedule:=True
    End Sub
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1