I have a macro copying data from one to another sheets within a .xls file. I would like now the do the same, however the data should be copied into another file (workbook) without opening this file. I cannot find a way to do so. Can anyone help? Thx
Sub Submit()
Dim LineCounter As Integer
Dim LineCounter2 As Integer
Dim currWB As String
Dim wbPath As String
Dim wbName As String
Application.EnableEvents = False
Application.ScreenUpdating = False
currWB = ActiveWorkbook.Name
wbPath = "C:\Admin\"
wbName = "LogBook.xls"
Workbooks.Open wbPath & wbName
Workbooks(currWB).Activate
Sheets("New").Calculate
Workbooks(wbName).Sheets("RECORD").Calculate
LineCounter = Sheets("New").Range("LinesRef").Value
LineCounter2 = Workbooks(wbName).Sheets("RECORD").Range("LinesRef2").Value
Set RangeStart = Range("InputRef").Offset(1, 0)
Set RangeEnd = Range("InputRef2").Offset(LineCounter, 0)
Set PasteStart = Range("DateRef").Offset(LineCounter2, 0)
Range(RangeStart, RangeEnd).Select
Selection.Copy
Workbooks(wbName).Activate
ActiveWorkbook.Sheets("RECORD").Select
PasteStart.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub