开发者

VBA Error code "Run Time Error 16, Too Complex"

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 populat开发者_运维技巧ed 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


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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜