Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: Resizing an array

    I have 2 arrays and start off with a "safe" number. At the end of my process i would like to remove empty items, but when i try to compile the code i get the msg "Array already dimensioned" how should i handle this?


    Private SourceProof(20, 1) As String
    Private TargetProof(20, 1) As String

    Private Sub removeEmptyItems(isSourceFile As Boolean)
    Dim i As Integer

    If isSourceFile Then
    For i = UBound(SourceProof) To LBound(SourceProof) Step -1
    If Len(SourceProof(i, 0) & SourceProof(i, 1)) > 0 Then
    ReDim Preserve SourceProof(i - 1, 1)
    End If
    For i = UBound(TargetProof) To LBound(TargetProof) Step -1
    If Len(TargetProof(i, 0) & TargetProof(i, 1)) > 0 Then
    ReDim Preserve TargetProof(i - 1, 1)
    End If
    End If

  2. #2
    weejas is offline Grumpy old man (training)
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 18
    ReDim only affects the last dimension of the array. In order for this to work, you'll need to pivot your arrays around.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts