问题描述
我一直试图在一维数组上使用过滤函数但收效甚微:
I have been trying to use the filter function on a one dimensional array with little success:
这是我一直在研究的一篇文章。
Here is a piece I have been working on.
当使用代码中间的msgbox时,代码不起作用,但当它被注释掉时代码似乎有效。这里有一些我不理解的东西。
When the msgbox in the middle of the code is used the code does not work and yet when it is commented out the code seems to work. There is something I am not understanding here.
Sub AAAAtest()
Dim EntryNo(1 to 5)As String
Dim SelectedNo()As String
'
EntryNo(1)= 1
EntryNo(2)= 2
EntryNo(3)= 3
EntryNo(4)= 4
EntryNo(5)= 5
'¥
MsgBox EntryNo(3)
'
$
SelectedNo = Filter(EntryNo,2,False)
'
MsgBox SelectedNo(1)
$
MsgBox SelectedNo(2)
'
MsgBox LBound(SelectedNo,1)
MsgBox UBound(SelectedNo,1)
'
结束子
Sub AAAAtest()
Dim EntryNo(1 To 5) As String
Dim SelectedNo() As String
'
EntryNo(1) = 1
EntryNo(2) = 2
EntryNo(3) = 3
EntryNo(4) = 4
EntryNo(5) = 5
'
MsgBox EntryNo(3)
'
SelectedNo = Filter(EntryNo, 2, False)
'
MsgBox SelectedNo(1)
MsgBox SelectedNo(2)
'
MsgBox LBound(SelectedNo, 1)
MsgBox UBound(SelectedNo, 1)
'
End Sub
任何帮助将不胜感激。谢谢
Any help would be appreciated. Thanks
推荐答案
这篇关于vba excel过滤器数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!