I have a file that I pull weekly (Site x) and I need to copy the data from this sheet to the bottom of the other file called "Site x Compiled". I have the code below, but the part of copy and paste is not working.
I'm still learning how VBA works, so can someone help me accomplish this?
````
Sub Compiling()
Dim InputFile As Workbook
Dim OutputFile As Workbook
Dim Inputpath As String
Dim Outputpath As String
'OKAY Set path for Input & Output
fileInputpath = "C:\Users\Desktop\Workbooks\"
Outputpath = "C:\Users\Desktop\Workbooks\"
'OKAY Open both workbooks first:
Set InputFile = Workbooks.Open(Inputpath & "C:\Users\Desktop\Workbooks\Site x.xlsx")
Set OutputFile = Workbooks.Open(Outputpath & "Site x Compiled.xlsx")
'NOT RUNNING PROPERLY - Now, copy what you want from InputFile:
InputFile.Sheets("Sheet1").Activate
InputFile.Sheets("Sheet1").Range("A2", Range("A2").End(xlDown).End(xlToRight)).copy
'NOT RUNNING PROPERLY - Now, paste to OutputFile worksheet:
OutputFile.Sheets("Sheet1").Activate
OutputFile.Sheets("Sheet1").Range("A2", Range("A2").End(xlDown)).Offset(1).PasteSpecial Paste:=xlPasteFormats
'OKAY Close InputFile & OutputFile:
Application.DisplayAlerts = False
InputFile.Close
OutputFile.Close savechanges:=True
End Sub
I'm still learning how VBA works, so can someone help me accomplish this?
````
Sub Compiling()
Dim InputFile As Workbook
Dim OutputFile As Workbook
Dim Inputpath As String
Dim Outputpath As String
'OKAY Set path for Input & Output
fileInputpath = "C:\Users\Desktop\Workbooks\"
Outputpath = "C:\Users\Desktop\Workbooks\"
'OKAY Open both workbooks first:
Set InputFile = Workbooks.Open(Inputpath & "C:\Users\Desktop\Workbooks\Site x.xlsx")
Set OutputFile = Workbooks.Open(Outputpath & "Site x Compiled.xlsx")
'NOT RUNNING PROPERLY - Now, copy what you want from InputFile:
InputFile.Sheets("Sheet1").Activate
InputFile.Sheets("Sheet1").Range("A2", Range("A2").End(xlDown).End(xlToRight)).copy
'NOT RUNNING PROPERLY - Now, paste to OutputFile worksheet:
OutputFile.Sheets("Sheet1").Activate
OutputFile.Sheets("Sheet1").Range("A2", Range("A2").End(xlDown)).Offset(1).PasteSpecial Paste:=xlPasteFormats
'OKAY Close InputFile & OutputFile:
Application.DisplayAlerts = False
InputFile.Close
OutputFile.Close savechanges:=True
End Sub