ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Values From A Non-Open Workbook? (https://www.excelbanter.com/excel-programming/357066-copy-values-non-open-workbook.html)

Jeffrey_Chcgo

Copy Values From A Non-Open Workbook?
 
I wish to copy data (values only) from
Workbooks("A").Worksheets("A").Range("A") into
Workbooks("B").Worksheets("B").Range("B") without opening Workbook A. Is this
possible?

Crowbar via OfficeKB.com

Copy Values From A Non-Open Workbook?
 
='C:\Directory\[excelfile.xls]Sheet1'!A1

This formula will get the data for you (you will have to change the directory
and file name of course). This formula only retrieves data not formulas

HTH

Regards



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1

Tom Ogilvy

Copy Values From A Non-Open Workbook?
 
Not directly. He meant do it with code I am sure (this is the fastest way to
do it)

say you wanted A1:A10 from sheet1 of the closed work in F1:F10 of the
activesheet


Sub GetDate()
With Range("F1:F10")
.Formula = "='C:\Directory\[excelfile.xls]Sheet1'!A1"
.Formula = .Value
End With
End Sub

If you closed file is like a data base and you want to "pull the data", you
can use ADO.
http://www.erlandsendata.no/english/...php?t=envbadac

Another way is to open the file after you turn screen updating off.
Transfer the information, then close it.

Application.ScreenUpdating = False
' open the file and get the info
Application.ScreenUpdating = True

no one is the wiser unless it takes a long time to open the workbook.

--
Regards,
Tom Ogilvy




"Jeffrey_Chcgo" wrote:

Thanks for your response. You mean enter
='C:\Directory\[excelfile.xls]Sheet1'!A1 as a cell formula? I am sorry but I
think I was unclear about my problem. I am looking for a way to copy a range
from an un-opened Workbook A into an opened workbook B using VBA. Can this
be done?

Thanks again for your consideration.

"Crowbar via OfficeKB.com" wrote:

='C:\Directory\[excelfile.xls]Sheet1'!A1

This formula will get the data for you (you will have to change the directory
and file name of course). This formula only retrieves data not formulas

HTH

Regards



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1


Jeffrey_Chcgo

Copy Values From A Non-Open Workbook?
 
Thanks for your response. You mean enter
='C:\Directory\[excelfile.xls]Sheet1'!A1 as a cell formula? I am sorry but I
think I was unclear about my problem. I am looking for a way to copy a range
from an un-opened Workbook A into an opened workbook B using VBA. Can this
be done?

Thanks again for your consideration.

"Crowbar via OfficeKB.com" wrote:

='C:\Directory\[excelfile.xls]Sheet1'!A1

This formula will get the data for you (you will have to change the directory
and file name of course). This formula only retrieves data not formulas

HTH

Regards



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1



All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com