Copy values from closed workbook

Alpacino

Well-known Member
Joined
Mar 16, 2011
Messages
511
Sorry I know this has probably been asked about a millions times anyone help with trying to copy values from workbook total sheet1 to workbook
Input sheet2 please
:)
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi VoG
Just can I say thank you for your help recently.
I can open workbook but want to save time and not open it :)
 
Upvote 0
This should be fast enough

Code:
Dim wb As Workbook
Application.ScreenUpdating = False
Set wb = Workbooks.Open(Total.xls)
wb.Sheets("Sheet1").UsedRange.Copy Destination:=Workbooks("Input.xls").Sheets("Sheet2").Range("A1")
wb.Close False
Application.ScreenUpdating = True
 
Upvote 0
Try

Code:
Application.ScreenUpdating = False
Set wb = Workbooks.Open(Total.xls)
wb.Sheets("Sheet1").Range("C3:C17").Copy Destination:=Workbooks("Input.xls").Sheets("Sheet2").Range("A1")
wb.Close False
Application.ScreenUpdating = True
 
Upvote 0
Dont u have to say where the file is
Eg c:\mydocuments\excelfiles\total.xls

Or will excel vba locate it in ur system???
 
Upvote 0
If the file is in the same folder as the file containing the code then just the file name should do. Otherwise you'll need the full path.
 
Upvote 0

Forum statistics

Threads
1,224,531
Messages
6,179,379
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top