I am new to Excel VBA and am getting stuck on how to copy and access macros between two instances of Excel. The two instances of Excel are required in order to speed up performance since they don't play well together when merged.
I have tried the following as recommended by post Copy Range between two instances of excel.
When I get to the line Set Dst =
I get the error 9. I am sure that the path is right.
I've tried reversing the files xlApp
, opening the files (different instances) in reverse order, verifying the extensions, and offering my computer a bribe.
Sub CopyValues()
'Test.xlsm is the source file
'Testd.xlsm is the destination file
Dim xlApp As Excel.Application
Dim Src As Range
Dim Dst As Range
Dim Vals() As Variant
Set xlApp = GetObject("C:\Users\Office\Desktop\Test.xlsm").Application
Set Src = xlApp.Workbooks("Test.xlsm").Worksheets("Sheet1").Range("A1:A9")
Set Dst = Workbooks("Testd.xlsm").Worksheets("Sheet1").Range("A1:A9")
Vals = Src
Dst.Value = Vals
End Sub
I keep getting a run time error 9 run out of source file
. I managed to get no errors, but also no result if run out of the destination file.