I've knocked together the code below and am at the point where I am getting no error messages but no value is being copied between the two workbooks/sheets.
The destination sheet is in the same workbook that the code is being run from - so I am opening another file and copying the data from there. I suspect the problem is that it is not copying the data correctly.
But the 2nd workbook definitely opens and closes correctly.
Any ideas?
The destination sheet is in the same workbook that the code is being run from - so I am opening another file and copying the data from there. I suspect the problem is that it is not copying the data correctly.
But the 2nd workbook definitely opens and closes correctly.
Any ideas?
Code:
Sub Import_Tracker()
Dim myPath As String
myPath = Application.GetOpenFilename
If myPath = "False" Then Exit Sub
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim xlThisSheet As Excel.Worksheet
Set xlBook = Workbooks.Open(myPath)
Set xlSheet = xlBook.Worksheets("Tracker")
Set xlThisSheet = ThisWorkbook.Worksheets("Tracker")
xlSheet.Select
Range("A3").Select
Selection.Copy
Sheets("Tracker").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
xlBook.Close
End Sub