Hi.
I've just spent more time trying to write an array to a sheet than writing the code to make the array, and then still couldn't do it!
This was in responce to this thread:
But I was trying to write arr3 direct like this:Sub SplitList() Dim arr1, arr2, arr3(), arr4, lr As Long, i As Long, j As Long, k As Long, x As Long Dim str As String lr = Cells(Rows.Count, 1).End(xlUp).Row arr1 = Range("A2:E" & lr) x = 0 For i = 1 To UBound(arr1) arr2 = Split(arr1(i, 3), ",") For j = 0 To UBound(arr2) For k = 1 To 5 If k = 3 Then str = str & Trim(arr2(j)) & "," Else str = str & Trim(arr1(i, k)) & "," End If Next ReDim Preserve arr3(x) arr3(x) = Split(Left(str, Len(str) - 1), ",") x = x + 1 str = "" Next Next arr4 = Application.Transpose(arr3) Range("G2:K" & x + 1).Value = Application.Transpose(arr4) End Sub
but it wouldn't write and have no idea why. Any answer please?Range("G2:K" & x + 1).Value = arr3