I have a workbook that will run 27/7 on a pc and also another workbook I will use scheduler to open 2 times a day, save and close. The code I will run in the workbook I will open 2 times a day is below. Can this be edited to open in a new workbook and close so it does not disturb the other workbook.? Thanks
Code:
Private Sub Workbook_Open()
Dim R As Range
Dim Sht As Worksheet
Dim Cel As Range
Set Sht = Sheets("Data")
Set R = Sht.Range("B4:B27,K4:K27,T4:T27")
For Each Cel In R
If Cel.Value < 0 Then
If Cel.Offset(0, 8).Value = "" Then Cel.Offset(0, 8) = Date
ElseIf Cel.Value >= 0 Then
Cel.Offset(0, 8).ClearContents
End If
Next Cel
Set R = Sht.Range("T4:T27")
For Each Cel In R
If Cel.Value = 0 Then Cel.Offset(0, 9) = Date
Next Cel
Set R = Sht.Range("C32:C37")
For Each Cel In R
If Cel.Value = 0 Then Cel.Offset(0, 2) = Date
Next Cel
Selection.ClearComments
Application.CalculateFull
ActiveWorkbook.Save
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Order\SaveTest.xlsx", FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
Application.Quit
End
End Sub