Hello,
I am wondering how I can get the code below to execute automatically on the 1st of every month at 5am in the morning?
Any help is greatly appreciated. Thanks in advance!
I am wondering how I can get the code below to execute automatically on the 1st of every month at 5am in the morning?
Sub Divide()
Dim fPath As String
Dim fName As String
Dim wb As Workbook
'Setup
Application.ScreenUpdating = False
fPath = "O:\Hopson\Industry\Mark to Market Source Files\" 'remember final \ in this string
fName = Dir(fPath & "*.xls") 'start a list of filenames
Do While Len(fName) > 0
Set wb = Workbooks.Open(fPath & fName) 'open found file
With ActiveSheet
.Range("Z1000").Value = 100
.Range("Z1000").Copy
.Range("E13:U100").PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide
.Range("Z1000") = ""
End With
wb.Close True 'close/save
fName = Dir 'get next filename
Loop
Application.ScreenUpdating = True
End Sub
Any help is greatly appreciated. Thanks in advance!