Like the title says, I'd like to copy data from a closed Excel workbook to the current one (which also houses the macro). I'm using Excel 2007.
The current workbook is named Carrier_Change.xlsx, and has one worksheet named "Analysis" where I'd like to copy the data to. It also has the macro that I'm running in it.
The closed file (which I'll refer to as the Report) also has one worksheet, but its location and name can vary. To find that Report, I've got a small function that prompts the user to select the closed report:
Beyond this, I'm stumped. I feel it must be trivial to do, but I can't figure out how to select the Carrier_Change workbook, paste the data in the "Analysis" worksheet, and close the Report workbook.
The current workbook is named Carrier_Change.xlsx, and has one worksheet named "Analysis" where I'd like to copy the data to. It also has the macro that I'm running in it.
The closed file (which I'll refer to as the Report) also has one worksheet, but its location and name can vary. To find that Report, I've got a small function that prompts the user to select the closed report:
Code:
Dim ReportWbk As Workbook 'workbook with report data
Dim Report As String 'name of file with report data
Application.FileDialog(msoFileDialogFilePicker).Show
Report = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)
Set ReportWbk = Workbooks.Open(Report)
ReportWbk.Sheets(1).Cells.Select
Selection.Copy