For Each sheet in WkBook problem
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
|