vba把单元格值赋给数组并由数组写⼊单元格
Sub 把单元格值赋给数组()
Dim ary()
Dim i, j, k, rowall, columnall, rownum As Integer
rownum = InputBox("输⼊标题⾏所占⾏数")
rowall = Cells(Rows.Count, 1).End(xlUp).Row
columnall = Cells(1, Columns.Count).End(xlToLeft).Column
k = WorksheetFunction.Count(Range(Cells(1, 1), Cells(rowall, 1)))
ReDim ary(k - 1)
For i = 0 To k - 1
If Cells(i + 1, 1) <> "" Then
ary(i) = Range(Cells(i + 1, 1), Cells(i + 1, columnall))
End If
Next
Worksheets.Add after:=Sheets(ActiveSheet.Name)怎么给数组赋值
ActiveSheet.Name = "汇总表"
For i = 0 To k - 1
' Range(Cells(i + 1, 1), Cells(i + 1, columall)) = ary(i)
Next
End Sub
这是⼀个半成品,有内容错误,暂时⽤于记录,我想把多维维数组中的⼀组数赋给单元格,看来直接引⽤多维数组的⾏标是不⾏的,难道只能⼀个⼀个的赋值,ary,测试可知是⼀个3维数组

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。