Dear all, I posted a question some days ago, and received an answer - however when I run the suggested code it gives me a "sub script out of range" error message.
I include the code for you:
Option Explicit
Sub DataToReport()
Dim wb As Workbook
Dim rng As Range
Dim lr As Long
Windows("file1").Activate
With Worksheets("data")
lr = .Cells(Rows.Count, "E").End(xlUp).down
Set rng = .Range("C6:E" & lr)
Set rng = Union(rng, .Range("K6:K" & lr))
Set rng = Union(rng, .Range("M6:M" & lr))
End With
Set wb = Workbooks("file2.xls")
rng.Copy wb.Worksheets("data2").Range("B484")
End Sub
The idea is to take columns C,D,E,K,L,M from file1 sheet "data" and copy into file2 sheet "data2". The data in file1 will vary in length, but always starts in row6.
When it is copied across, it always starts on row 484.
The columns are all of equal length, I just cant work out what is wrong.
Please help if you can.
love
Amy xx
Bookmarks