| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

Dim brr()是Sub 按钮4_Click()与Function GetB(bstr, c) 的公用数组，必须放在Sub 按钮4_Click()上，请问应该怎样声明或放置,放在Sub 按钮3_Click()后面提示end sub怎样...要求Dim brr()只在Sub 按钮4_Click()+函数中起作用

Sub 按钮3_Click()
................
end sub

Dim brr()
Sub 按钮4_Click()
xstep = 21     '每组多少行
ReDim Err(1 To UBound(crr) / xstep + 1, 1 To 2)
For i = 1 To UBound(brr)
b0 = b0 & "," & i
Next
b0 = Mid(b0, 2)
.................
c = crr(i + k, 1)
bstr = GetB(bstr, c)
If Len(bstr) = 0 Then GoTo 100
If Len(bstr) And InStr(bstr, ",") = 0 Then
n = n + 1
'Err(n, 1) = brr(bstr, 1)
............
100:    Next i
End Sub

Function GetB(bstr, c)
cc = " " & Mid(c, 5) & " "
bb = Split(bstr, ",")
For Each i In bb
b = brr(i, 1)
xrr = Split(b, " ")
s = 0
..........
If s >= xmin And s <= xmax Then GetB = GetB & "," & i
Next
GetB = Mid(GetB, 2)
End Function

[此贴子已经被作者于2022-11-27 23:13编辑过]

sub 按钮3 里面别用brr(),改成br()...

1、工程级公用变量，

2、窗体级 公用变量

3、窗体内部公用变量

4、过程/函数 内部变量

--------------

• 4
• 1/1页
• 1

Powered by Discuz, Processed in 0.033963 second(s), 9 queries.