vba 怎样对数组进行一次性装入

我想把excel单元单元格所在列的所有数据都装入数组 arry , 不要用循环, 能不能一次性装入 ?

以下代码出错, 错误: 13 类型不匹配, 请vba 高手来看看 ?
sub 一次性转载数组()
Dim RW As Long
Dim CO As Long
Dim arry() As String

CO = ActiveCell.Column
RW = Cells(Rows.Count, CO).End(xlUp).Row

ReDim arry(1 To RW)
arry() = Range(Cells(1, CO), Cells(RW, CO)) ' 出错 类型不匹配

end sub

Sub 一次性转载数组()

Dim RW As Long

Dim CO As Long

Dim arry

CO = ActiveCell.Column

RW = Cells(Rows.Count, CO).End(xlUp).Row

arry = Range(Cells(1, CO), Cells(RW, CO)) '  出错 类型不匹配

MsgBox UBound(arry)

End Sub

追问

这样写不会出错, 但下面的比较语句会出错:
For I = 1 To RW - 1
For J = I + 1 To RW
If arry(I) = arry(J) Then '出错, 9 下标越界
GoTo finditem
End If
Next J
Next I
程序的功能是想找到重复的单元格

追答Sub 一次性转载数组()

Dim RW As Long

Dim CO As Long

Dim arry

CO = ActiveCell.Column

RW = Cells(Rows.Count, CO).End(xlUp).Row

arry = Range(Cells(1, CO), Cells(RW, CO)) '  出错 类型不匹配

MsgBox UBound(arry)

 For i = 1 To RW - 1

 For j = i + 1 To RW

 If arry(i, 1) = arry(j, 1) Then '出错, 9  下标越界

 GoTo finditem

 End If

 Next j

 Next i

finditem: MsgBox i & "/" & j & "|" & arry(i, 1) & "/" & arry(j, 1)

End Sub

温馨提示:答案为网友推荐,仅供参考
相似回答