Factor3
03-09-2007, 02:48 PM
So this code "seems" like it should work, but it's not working (I'm sure you've never heard that before:rotlaugh: ).
I've got some workbooks that have cosistent ranges on them:
Worksheets(1).Range("B5:B246")
I'm trying to copy this range from every single workbook, and place it onto a "Summary" workbook (I though the copy and offset method was appropriate here).
Sub Compile_Indexes()
Dim wbk1 As Workbook
Dim wbk2 As Workbook
Dim indx As Range
'This is the summary workbook that will compile the ranges
Set wbk2 = Workbooks("summary")
'This begins the process of sorting through each of the workbooks that are open
For Each wbk1 In Workbooks 'Workbooks will refer to all open workbooks,right?
If Not wbk1.Name = wbk2.Name Then
'This automates the copying of ranges and pastes them into the summary book
For Each indx In wbk1.Worksheets(1).Range("B5:B246")
indx.Copy Destination:=wbk2.Worksheets(1).Range("B:B").Offset(0, 1)
Next indx
End If
Next wbk1
End Sub
Thanks so much,
Benjamin
I've got some workbooks that have cosistent ranges on them:
Worksheets(1).Range("B5:B246")
I'm trying to copy this range from every single workbook, and place it onto a "Summary" workbook (I though the copy and offset method was appropriate here).
Sub Compile_Indexes()
Dim wbk1 As Workbook
Dim wbk2 As Workbook
Dim indx As Range
'This is the summary workbook that will compile the ranges
Set wbk2 = Workbooks("summary")
'This begins the process of sorting through each of the workbooks that are open
For Each wbk1 In Workbooks 'Workbooks will refer to all open workbooks,right?
If Not wbk1.Name = wbk2.Name Then
'This automates the copying of ranges and pastes them into the summary book
For Each indx In wbk1.Worksheets(1).Range("B5:B246")
indx.Copy Destination:=wbk2.Worksheets(1).Range("B:B").Offset(0, 1)
Next indx
End If
Next wbk1
End Sub
Thanks so much,
Benjamin