billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Afternoon
I've been attempting to understand arrays and in particular how to write an array (see below) to a range.
This code does not include the last element "July" - not sure why?
Thanks for any help/explanation
If I utilize this code, which places all values in the array then copies to range F1. I have no problem.
I've been attempting to understand arrays and in particular how to write an array (see below) to a range.
This code does not include the last element "July" - not sure why?
Thanks for any help/explanation
Code:
Dim arr As Variantarr = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "July")
[D2].Resize(UBound(arr)) = Application.Transpose(arr)
If I utilize this code, which places all values in the array then copies to range F1. I have no problem.
Code:
Dim myarray As Variant
myarray = Range("C1", Range("C" & Rows.Count).End(xlUp)).Value
[F1].Resize(UBound(myarray)) = myarray