VBA Error code “Run Time Error 16, Too Complex”

我与影子孤独终老i 提交于 2019-12-08 06:49:13

问题


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


回答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!




回答2:


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



来源:https://stackoverflow.com/questions/4838000/vba-error-code-run-time-error-16-too-complex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!