Unexpected result using Range("E3").Resize(UBound(Items, 1), 1) = Items
What I got was array element 1 repeated ubound(item) times
Here's the code
' This routine fills an array with headers to detailed info in a separate worksheet
' Only headers reside in column 1 while the detail is in subsequent columns
' We use an array to establish the number of rows required for borders as well as
' to optimize speed.
Dim ws As Worksheet, rg As Range, Items() As String, i As Long, Row As Long, wsRow As Long
Set ws = Sheets("Member Passwords")
For wsRow = 2 To ws.UsedRange.Rows.Count
If Not IsEmpty(ws.Cells(wsRow, 1)) Then
i = i + 1
ReDim Preserve Items(1 To i)
Items(i) = ws.Cells(wsRow, 1)
End If
Next wsRow
Set rg = Range("E3:E" & 2 + UBound(Items))
With rg
.Cells.Clear
.BorderAround LineStyle:=xlContinuous, Weight:=xlMedium
.Borders(xlInsideHorizontal).LineStyle = xlNone
End With
-----
' This just repeated the first array element ubound(items,1) times
' Range("E3").Resize(UBound(Items, 1), 1) = Items
-----
' This was required to write all array elements
Row = 2
For i = LBound(Items) To UBound(Items)
Row = Row + 1
Range("E" & Row) = Items(i)
Next i