"Array already dimensioned" error RRS feed

  • Question

  • According to the literature it should be possible to redim the last dimension of a multidimensional array, but the code below throws up the error "Array already dimensioned", highlighting "ReDim Preserve aAnn(12".

    Any advice re. what I've done wrong and how to fix it would be greatly appreciated.

    Excel 2003


    Dim aAnn(12,1) as Integer

    ' 12 for the months Jan-Dec, unknown quantity of days for each month, so 2nd dim needs to expand as required.

    ' load other variables, etc.

        If c(2, 1).Value = iM Then
          i = i + 1             ' Dim of DAY array
          If i > n Then
            ReDim Preserve aAnn(12, i)
            n = i
          End If
        End If


    Many thanks!

    • Edited by goneps Friday, November 30, 2012 4:30 AM
    Friday, November 30, 2012 4:29 AM

All replies