VBA 错误代码“运行时错误 16,太复杂”

发布于 2024-10-14 15:27:55 字数 445 浏览 3 评论 0原文

运行填充的动态数组时,我尝试获取元素的内容并收到以下错误运行时错误'16':表达式太复杂。表达式太复杂?

Impactdays 很长,我通过简单地将范围填充到数组中来填充电子表格,

ReportArray = Impact_Chart.Range("Data.EventNumber").CurrentRegion.Value

For i = LBound(ReportArray) + 1 To UBound(ReportArray)

If ReportArray(i, iImpactCol) > 0 Then
        iImpactDays = ReportArray(i, iImpactCol)<-- Tosses error here

        'more stuff

任何想法哦,一切的大师? :) 哦,这是2007年

When running a Dynamic array that is populated I am trying to get the contents of an element and receive the following error Run-Time Error '16': Expression too complex. The expression that is to complex?

Impactdays is a long, I populated the spreadsheet by simply stuffing the range into the array

ReportArray = Impact_Chart.Range("Data.EventNumber").CurrentRegion.Value

For i = LBound(ReportArray) + 1 To UBound(ReportArray)

If ReportArray(i, iImpactCol) > 0 Then
        iImpactDays = ReportArray(i, iImpactCol)<-- Tosses error here

        'more stuff

any ideas oh gurus of everything? :)
Oh this is 2007

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍白女子 2024-10-21 15:27:55

检查您是否没有

   If (Not MyArray) = -1  

在程序中的某个地方使用类似的东西。 已报告这与您的错误之间存在联系。

哈!

Check if you are not using something like

   If (Not MyArray) = -1  

somewhere in your program. It has been reported a connection between that and your error.

HTH!

云之铃。 2024-10-21 15:27:55

我确实删除了有问题的堆栈指针,并使用以下内容来检查是否按

Function IsArrayDimensioned(TargetArray() As Variant) As Boolean
Dim s As Integer
On Error Resume Next
s = UBound(TargetArray, 1)
If Err.Number = 0 Then
    IsArrayDimensioned = True
Else
    IsArrayDimensioned = False
End If
End Function

广告宣传的那样工作

I did remove the offending stack pointer and used the following to check instead

Function IsArrayDimensioned(TargetArray() As Variant) As Boolean
Dim s As Integer
On Error Resume Next
s = UBound(TargetArray, 1)
If Err.Number = 0 Then
    IsArrayDimensioned = True
Else
    IsArrayDimensioned = False
End If
End Function

Works as advertised

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文