I would like to use variables that I can pass to a SUB for coping an array from one sheet to another sheet in another workbook. Without variables this works well for me:
Dim RNG1 as Range, RNG2 as Range
Sub CopyRange()
Set RNG1 = Workbooks("Program.xlsm").Sheets("Input").Range("G9:G19")
Set RNG2 = Workbooks("Data.xlsx").Sheets("Reformatted").Range("A3:A13")
RNG1.Copy RNG2
End Sub
I would like to be able to pass "Data.xlsx" as a variable to the SUB. I've tried using String variables, but have not found the solution.
Any help would be appreciated.