- Joined
- Oct 30, 2008
- Messages
- 4
- Reaction score
- 0
Is there code that will run an autoexec type of code that will check the day of the week of the current date and if it = Friday, then create a copy of a specific WkSheet within a Workbook and paste and rename it in another workbook.
I have the code down that will create the back up however, I am unsure on how to schedule the task to run every Friday.
I found the attached code that will work correctly when asked to execute, however, it does not launch when the user opens the Workbook, WHY?
Any suggestions?
Karen
Here is what I have so far:
Public Sub Workbook_Open()
If VbDayOfWeek(Date) = 5 Then ' = DatePart(d, Date, vbThursday) Then
Call mcrArchiveStageStatus
Else
Exit Sub
End If
End Sub
Sub mcrArchiveStageStatus()
'
' mcrArchiveStageStatus Macro
' Macro recorded 10/29/2008 by Karen Schaefer
Workbooks.Open Filename:="C:\Development\LEDR\StageStaus_Archive.xls"
Windows("Metrics_IPT_747-8.xls").Activate
Sheets("By Stage Status").Select
Sheets("By Stage Status").Copy Before:=Workbooks("StageStaus_Archive.xls"). _
Sheets(1)
Sheets("By Stage Status").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("By Stage Status").Select
Sheets("By Stage Status").Select
Sheets("By Stage Status").Name = Format(Date, "mmm dd yy")
Windows("StageStaus_Archive.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
I have the code down that will create the back up however, I am unsure on how to schedule the task to run every Friday.
I found the attached code that will work correctly when asked to execute, however, it does not launch when the user opens the Workbook, WHY?
Any suggestions?
Karen
Here is what I have so far:
Public Sub Workbook_Open()
If VbDayOfWeek(Date) = 5 Then ' = DatePart(d, Date, vbThursday) Then
Call mcrArchiveStageStatus
Else
Exit Sub
End If
End Sub
Sub mcrArchiveStageStatus()
'
' mcrArchiveStageStatus Macro
' Macro recorded 10/29/2008 by Karen Schaefer
Workbooks.Open Filename:="C:\Development\LEDR\StageStaus_Archive.xls"
Windows("Metrics_IPT_747-8.xls").Activate
Sheets("By Stage Status").Select
Sheets("By Stage Status").Copy Before:=Workbooks("StageStaus_Archive.xls"). _
Sheets(1)
Sheets("By Stage Status").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("By Stage Status").Select
Sheets("By Stage Status").Select
Sheets("By Stage Status").Name = Format(Date, "mmm dd yy")
Windows("StageStaus_Archive.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub