ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pulling information from a closed workbook (https://www.excelbanter.com/excel-programming/385084-pulling-information-closed-workbook.html)

edluver

pulling information from a closed workbook
 
i know that the following UDF will retrieve specified information from a
closed notebook:

Function GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As Object)
With ActiveSheet.cellRange
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Function


Sub test1()
GetValuesFromAClosedWorkbook "E:\Documents\Work\Fraud Detection",
"DFDDEPFRDH.xls", _
"Untitled", .Select
End Sub

i have 2 questions. 1) how can i alter this so it will copy the entire
worksheet over?

2) How can i alter this to copy a second set of sheets to Sheet2 instead of
Sheet1?

thanks for your time.

Ron de Bruin

pulling information from a closed workbook
 
Maybe this
http://www.rondebruin.nl/copy7.htm

But for a whole sheet I think you can better open the workbook and copy the sheet to your workbook

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"edluver" wrote in message ...
i know that the following UDF will retrieve specified information from a
closed notebook:

Function GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As Object)
With ActiveSheet.cellRange
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Function


Sub test1()
GetValuesFromAClosedWorkbook "E:\Documents\Work\Fraud Detection",
"DFDDEPFRDH.xls", _
"Untitled", .Select
End Sub

i have 2 questions. 1) how can i alter this so it will copy the entire
worksheet over?

2) How can i alter this to copy a second set of sheets to Sheet2 instead of
Sheet1?

thanks for your time.



All times are GMT +1. The time now is 05:42 AM.

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