Hi, I have macro code below.
Currently it saves the work book as separate file (as back up).
The file has three sheets. (Tip Calculator, Daily Payroll, Two Weeks Payroll).
I want to be able to save (overwrite to current file) the "Two Weeks Payroll" Sheet only when I click the Macro Button.
Can you help me? Thanks!
-------------------------------------------------------------
Sub Button1_Click()
' Local Variables
Dim rngCDest As Range
If Worksheets("Two Weeks Payroll").Range("B1") = "" Then
Worksheets("Two Weeks Payroll").Range("B1:B62") = Worksheets("Daily Payroll").Range("F1:F62").Value
Else
Worksheets("Two Weeks Payroll").Range("P1").End(xlToLeft).Offset(0, 1).Range("A1:A62") = Worksheets("Daily Payroll").Range("F1:F62").Value
End If
If Worksheets("Two Weeks Payroll").Range("M2") <> "" Then
MsgBox "Two Weeks Payroll is Full. Please Go to Two Weeks Payroll Tap, and click the reset button"
End If
' Setup path and file name format
fPath = ThisWorkbook.Path & "\"
fName = Format(Date - 1, "yyyymmdd")
ThisWorkbook.SaveAs fPath & fName
MsgBox "Saved"
End Sub
Bookmarks