Tom Ogilvy wrote
Sub GrabData()
Dim varr As Variant
Dim rng As Range
Dim i As Long
Dim sh As Worksheet
Dim wkbk as Workbook
varr = Array("A.xls", "B.xls", "c.xls")
Set sh = Workbooks("Master.xls").Worksheets(1)
For i = LBound(varr) To UBound(varr)
Set wkbk = Workbooks.Open("c:\Data\" & varr(i))
Set rng = wkbk.Worksheets(1). _
UsedRange
rng.Copy sh. _
Cells(Rows.Count, 1).End(xlUp)(2)
Next
End Sub
Tom,
I looked at your code with interest because I have a similar need, but I
only need certain data imported into respective column areas of the
master file. I recorded the manual steps required to accomplish this
using your file names (slightly different paths):
Sub GrabData()
Workbooks.Open Filename:="C:\Data\EXCEL\A.xls"
Range("B2:B10").Select
Selection.Copy
Windows("Master.xls").Activate
Range("B2").Select
ActiveSheet.Paste
Workbooks.Open Filename:="C:\Data\EXCEL\B.xls"
Range("C2:C10").Select
Selection.Copy
Windows("Master.xls").Activate
Range("C2").Select
ActiveSheet.Paste
Workbooks.Open Filename:="C:\Data\EXCEL\C.xls"
Range("D2
10").Select
Selection.Copy
Windows("Master.xls").Activate
Range("D2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Can you help me (translated "provide me with") code similar to yours to
do what I want?