I receive the error: array already dimensioned, when running the following code:
the array and the counter n is dimensioned as public, in the Declaration part of the code:Private Sub check_QREF(i As Integer, j As Long) If IsEmpty(Worksheets(GS_ANNEX_WS).Cells(i, j)) Then missingQrefs(1, n) = i missingQrefs(2, n) = j n = n + 1 ReDim Preserve missingQrefs(1 To 2, 1 To n) MsgBox n End If 'MsgBox "checked in row" & missingQrefs(1, n) & " in column " & missingQrefs(2, n) End Sub
And the sub check_qref is called by another sub with the row and column number of the cell where the qref is expected to be. in that sub n is initialized to 1.Dim n As Long Dim missingQrefs(1 To 2, 1 To 1) As Long
Last edited by ggabi; 02-08-2012 at 01:59 AM.
An array declared with subscripts is static. A dynamic array is declared with empty parens.
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
Thanks a lot!!!! - I imageined something much more complicated. :-)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks