Array function in Excel VBA

I have a function in VBA that generates an array of strings. It works fine when called from another VBA function, but not when called from the worksheet. Here's how it should be used: * select A1:A3 * write in the formula bar `=Test()`, then hit `Ctrl-Shift-Enter` to make it an array function * A1 should contain `A`, A2 should contain `B`, and A3 should contain `C` When I actually try this, it puts `A` in all three cells of the array. How can I get the data returned by `Test` into the different cells of the array? ---- For those who'd like to see it, here's the code of the function. Keep in mind, the function works fine when called from other functions. Function Test() As String() Dim a(1 To 3) As String a(1) = "A" a(2) = "B" a(3) = "C" Test = a End Function

以上就是Array function in Excel VBA的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » excel

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏