Jump to content
Fórum Script Brasil
  • 0

Redim Preserve - Subscript out of range


Question

Boa tarde pessoa, 

Estou com dificuldade de redimensionar um vetor, e preciso de um "help".

Tenho um vetor FSLList com com diversas variáveis (quantidade de linhas variáveis e 2 colunas), gostaria de passar alguns dados desse vetor para um outro vetor (simulando um filtro).

O problema é que quando tento Redimensionar o meu vetor FSLTLIST  com "Preserve" aparece Subscript out of range. 

Alguém sabe me dizer o que estou errando?

 

Dim FSLList As Variant
Dim FSLTList() As Variant

Lastrow2 = ThisWorkbook.Sheets("FSL").Cells(Rows.Count, 1).End(xlUp).Row

FSLList = ThisWorkbook.Sheets("FSL").Range("C2:D" & Lastrow2)

ReDim FSLTList(1 To 1, 1 To 2)

    For i = LBound(FSLList) To UBound(FSLList)
        If UCase(FSLList(i, 1)) Like "*" & UCase(TextBox7.Text) Or UCase(FSLList(i, 2)) Like "*" & UCase(TextBox7.Text) & "*" & "*" Then
            FSLTList(UBound(FSLTList), 1) = FSLList(i, 1) 'Assign the array element
            FSLTList(UBound(FSLTList), 2) = FSLList(i, 2) 'Assign the array element
            ReDim Preserve FSLTList(UBound(FSLTList) + 1, 1)

        End If
    Next i

    FSLListBox.List = FSLTList

End Sub

 

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148680
    • Total Posts
      644501
×
×
  • Create New...