0
我想创建一个函数,它执行一些检查并向我的调用子函数返回一个数组。这个数组不能真的在sub中创建,然后传递给函数进行操作。子只是调用必须创建一个数组并将其返回给子的函数。这可能吗?有一个函数返回一个数组
这是我的功能。第一行显然是不正确的,但这是我想要做的想法。
Function rMMopened(1 to 1000)() As Long
Dim r As Long, i As Long
Dim ttd As Worksheet
Dim lrttd As Long
Set ttd = Sheets("Tasks_to_do")
lrttd = ttd.Cells(Rows.count, 1).End(xlUp).Row
ReDim rMMopened(1 To lrttd)
i = 1
For r = 2 To lrttd
If ttd.Cells(r, 10) = "Phase 2" Then
If InStr("MASTER", ttd.Cells(r, 4)) Then
rMMopened(i) = r
i = i = 1
End If
End If
Next
ReDim Preserve rMMopened(1 To (i - 1))
End Function
感谢
为什么不能在此数组中的'Sub'产生的呢? –
好吧,它“可以”,但它会更清洁这种方式。我猜这可能无法完成,或者它更容易创建子数组中的数组? – user2385809