Open Existing Workbook In New Excel

rockyw

Well-known Member
Joined
Dec 26, 2010
Messages
1,196
Office Version
  1. 2010
Platform
  1. Windows
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
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top