comand1_click 用来将sheet1中第一列单元格中所有的值保存到的变量数组MJ(x)中
那么怎么在comand2_click中调用数组MJ(x)当中的值,不是重新赋值,进行运算呢?
需要怎么定义变量,我试过全局变量,但是提示缺少数组。
需要大神给个思路,有具体代码最好,问题解决后立即给分,多谢
vb6.0 怎么调用其中一个click的变量数组到另一个click中使用
答案:2 悬赏:50 手机版
解决时间 2021-02-25 15:44
- 提问者网友:箛茗
- 2021-02-25 06:54
最佳答案
- 五星知识达人网友:患得患失的劫
- 2021-02-25 08:09
Dim MJ() As Integer
Private Sub Command1_Click()
ReDim MJ(3)
MJ(0) = 111
MJ(1) = 222
MJ(2) = 333
MJ(3) = 444
End Sub
Private Sub Command2_Click()
Print MJ(0)
Print MJ(1)
Print MJ(2)
Print MJ(3)
End Sub
Private Sub Command1_Click()
ReDim MJ(3)
MJ(0) = 111
MJ(1) = 222
MJ(2) = 333
MJ(3) = 444
End Sub
Private Sub Command2_Click()
Print MJ(0)
Print MJ(1)
Print MJ(2)
Print MJ(3)
End Sub
全部回答
- 1楼网友:北城痞子
- 2021-02-25 09:30
option base 1
private sub form_click()
me.cls
randomize
dim a(8) as integer
print "原数组:"
for i = 1 to 8
a(i) = int(rnd * (99 - 10) + 10)
print a(i);
next i
print
dim tmp(8) as integer
for i = 1 to 4
tmp(i) = a(i + 4)
next i
for j = 5 to 8
tmp(j) = a(j - 4)
next j
print "互换后原数组:"
for i = 1 to 8
print tmp(i);
next i
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯