If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Resizing an array

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-09, 11:56
mikezx10 mikezx10 is offline
Registered User
 
Join Date: Oct 2003
Posts: 226
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?

Thanks

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
Next
Else
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
Next
End If
Reply With Quote
  #2 (permalink)  
Old 06-02-09, 12:15
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
ReDim only affects the last dimension of the array. In order for this to work, you'll need to pivot your arrays around.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On