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
Question
vitorzilocchi 0
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.