Copy Destination fails
Hi Howard,
You've got a lot of unqualified references going on in your code, and the
loop won't work as constucted. Try the following sub to see if it does what
you want.
It assumes the following:
- you will place the code a standard module in Workbooks("Models").
- the sheets are arranged in such order that all sheets data will be copied
FROM are LEFT of Sheets("Carroll")
Sub CopyToOtherBook5()
' Copies a range in wbkSource to a location in wbkTarget
' Data is transposed from vertical (source) to horizontal (target)
Dim wbkSource As Workbook, wbkTarget As Workbook
Dim rngSource As Range, rngTarget As Range
Dim i As Long, lShts As Long
Dim sName As String, vaData As Variant
Set wbkSource = ThisWorkbook
Set wbkTarget = Workbooks("A1Results.xls")
lShts = wbkSource.Sheets("Carroll").Index - 1
For i = 1 To lShts
sName = wbkSource.Sheets(i).Name
vaData = wbkSource.Sheets(i).Range("IV29").End(xlToLeft).Re size(39, 1)
Set rngTarget =
wbkTarget.Sheets(sName).Range("C100").End(xlUp).Of fset(1, 0).Resize(1, 39)
rngTarget = Application.WorksheetFunction.Transpose(vaData)
Next
End Sub
HTH
Regards,
GS
|