ReDim Error

cagataybaser

New member
Joined
Aug 14, 2014
Messages
13
Reaction score
0
Points
0
I have a code like this
Code:
Private Sub Sample()
Dim exstrn() As String
Dim i As Integer
i = 1
Do
i = i + 1 ReDim Preserve exstrn(0 To UBound(exstrn) + i) As String
And I got error message Subscript out of range with ReDim Preserve
Can you help me about that?
 
Code:
Private Sub Sample()
Dim exstrn As Variant
Dim i As Long


    ReDim exstrn(1 To 1)
    i = 1
    Do
        ReDim Preserve exstrn(1 To i)
        'do your stuff
        i = i + 1
    Loop
 
Code:
sub M_snb()
    Dim sn() As String
    ReDim sn(0)

    Do
       ReDim Preserve sn(UBound(sn) + 1)
    Loop
End Sub
 
Back
Top