Reputation: 9393
How do i mention the path of my excel file in my vba? The thing Im trying to do is, I have to copy the excel file contents to the end of another excel file. I have selected all the cells of excel file and copied like these
This is my excelfile1.xlsx
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Now after copying the whole file I have to paste it to the end of another excel file located at D:\samples\excel2.xls
How do I mention the path of these file in VBA and paste to its end from my VBA code?
Upvotes: 1
Views: 463
Reputation: 175936
If you record this step of actions, you will get almost the exact same code that would result from writing it manually;
Workbooks.Open Filename:="d:\samples\excel2.xls"
Range("Al").Select
ActiveSheet.Paste
Upvotes: 2