如果满足条件,请运行适当的宏

时间:2019-05-24 13:54:39

标签: excel vba conditional-statements

因此,我有一个由子(名称)组成的数组,我遍历了它们,然后返回满足条件的子(名称)。因此,循环返回(打印)诸如sub3,sub4,sub6之类的适当项目,但是如何调用该subs?当我尝试时,出现错误“预期的子,函数或属性”。

subs = Array("sub1", "sub2", "sub3","sub4", "sub5", "sub6", "sub7")

For j = 1 To arr_size
  For i = 1 To 25
    If arr(j) = i Then
    'Call subs(i)        'not working
    Debug.Print subs(i)  'returns appropriate subs
    End If
  Next i
Next j

0 个答案:

没有答案