Hi,
Im having a code below for copying data from workbook to another. The Master file is stored in SharePoint so I would like to have backup file as well to be stored in server.
Any ideas how to modify the code so that it updates the backup file also each time the macro is running?
Im having a code below for copying data from workbook to another. The Master file is stored in SharePoint so I would like to have backup file as well to be stored in server.
Any ideas how to modify the code so that it updates the backup file also each time the macro is running?
VBA Code:
Sub CopyData()
Application.ScreenUpdating = False
Dim LastRow As Long, i As Integer, ActSht As Worksheet
Set ActSht = ActiveSheet
LastRow = ActSht.Range("A" & Rows.Count).End(xlUp).Row
Workbooks.Open Filename:="path...."
Worksheets("Master").Unprotect Password:="password"
For i = 2 To LastRow
If ActSht.Cells(i, 15).Value = "Yes" Then
Range(ActSht.Cells(i, 1), ActSht.Cells(i, 14)).Copy Worksheets("Master").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next i
Worksheets("Master").Protect Password:="password"
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub