作者godend (还是 有希望的)
看板Programming
标题[问题] vba将选取范围的值套入阵列
时间Fri Oct 25 15:41:24 2019
小弟初学vba矩阵,但一开始就有点小问题
今天我用一个intputbox弹出一个视窗来让使用者选取一个方阵范围
ex:2*2,3*3,4*4
set matrix = Application.IntputBox(prompt:="选取矩阵", Title:="matrix",
type:=8)
Dim row,column as Integer
row=matrix.Row.Count
column=matrix.Row.Count
那接下来我有一个二维阵列
dim a()
reDim a(row-1,column-1)
要怎麽把选取范围的值指定到阵列内?
就是让a(0,0)=matrix(0,0) a(0,1)=matrix=(0,1)...以此类推
我写成
for i= 0 to row-1
for j= 0 to column-1
a(i, j )= matrix.Cells(i,j).Value
这样好像会有问题
请问要怎麽把一个范围的值指定到二维阵列内呢?
感激不尽
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 101.11.18.15 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Programming/M.1571989288.A.CC1.html
1F:→ tutu8789: Arr=.Range(cells(左上), cells(右下)) 31.154.78.118 11/20 02:28