Can't say for sure without looking at your file. If there's any
reason vData is not a 2D array then that line will definitely throw
an error. Try this on any sheet...
Sub test()
Dim v
v = Range("A1:D2")
Debug.Print "rows:=" & UBound(v)
Debug.Print "cols:=" & UBound(v, 2)
End Sub
..and it should return...
rows:=2
cols:=4
Garry
It returned 2 & 4 for every sheet, Summary & A to G, and the same
for a new workbook made with same names and the data copied to each
sheet.
I did notice while the .cells... line was yellow highlighted that the
.End(xlDown) was showing -4162 when mouse over it.
vData = wks.Range("A2", wks.Range("D2").End(xlDown))
'Assign the array to the next row position
.Cells(lNextRow, 1).Resize(UBound(vData), UBound(vData), 2) =
vData
Then another time it showed a date. Column D header is "Datum" and
custom formatted to dd-mm-yyy.
I have no idea why it showed -4162 that one time.
Howard
Have a look in the ObjectBrowser for XlDirection, then click each item
listed to see its value. Here's what you should see...
xlDown = -4121
xlToLeft = -4159
xlToRight = -4161
xlUp - -4162
Sounds like you might need to close/reopen Excel to see if these
anomolies go away!
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion