gerald24

Board Regular
Joined
Apr 28, 2017
Messages
95
Hi Guys,

Could you help me with the codes below?
What I want to accomplish is for the codes to save back up ONLY ON FRIDAYS but my codes are not working.

Code:
Sub Time_In()
Dim FileName As String
' Keyboard Shortcut: Ctrl+e
'
    'On cell and saves file
    Sheets("TITO").Select
    ActiveCell.Offset(0, 0).Select
    ActiveCell.Value = Format(Now(), "HH:MM mm/dd/yyyy")
    ActiveCell.NumberFormat = "h:mm AM/PM"
    
    Call Shift 'ignore this in this question
    
If Weekday(Now(), vbFriday) Then
    
    Application.DisplayAlerts = False
    For Each w In Application.Workbooks
    w.Save
    FileName = ActiveWorkbook.Name
    ActiveWorkbook.SaveAs FileName:="\\Pathfile\" & FileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    Application.DisplayAlerts = True
    w.Close
    
    Next w

    End If

   
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try this:

Code:
If Weekday(Now()) = vbFriday Then

Dim FileName As String

Application.DisplayAlerts = False

ActiveWorkbook.Save

FileName = ActiveWorkbook.Name

With ActiveWorkbook
.SaveAs([COLOR=#ff0000]"\\PathFile\" [/COLOR]& FileName, FileFormat:=52
.Close 0
End With

Application.DisplayAlerts = True

End If

Make sure that you change the "\\PathFile" that I highlighted to the file path where you want the document to be saved. Let me know if this works for you.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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