Hello, I have a simple spreadsheet (3 cols and 2 rows) and I'm trying to create a script to open it, copy its data and insert it into another one.
Path = "C:\Users\user_name\Documents\excell\planilha1.xlsx"
Set objexl = CreateObject("Excel.application")
objexl.Visible = True
Set objwkb = objexl.Workbooks.Open(Path)
Set objsht = objwkb.Sheets(1)
objsht.Range("A2").Select
objsht.Range(Selection.End(xlToRight), Selection.End(xlDown)).Select
Selection.Copy
When I run, the worksheet opens and the following error is returned: Objeto necessário: 'Selection'
, and the error occurs on line 7. Could someone give me a light?