irisqueiroz
Member
Hi!
I'm trying to right a code that needs a dynamic array.
Basically, I'd like to look into all found values (method find) in a current region and store them address in a array. For example, if I find 4 values (then j=4, in my code) in the region that im looking for, then i'd like my array to be:
endereço(1) = A1
endereço(2) = A2
endereço(3) = A3
endereço(4) = A4
My array varies in function of j.
how can I write it?
I'm trying to right a code that needs a dynamic array.
Basically, I'd like to look into all found values (method find) in a current region and store them address in a array. For example, if I find 4 values (then j=4, in my code) in the region that im looking for, then i'd like my array to be:
endereço(1) = A1
endereço(2) = A2
endereço(3) = A3
endereço(4) = A4
My array varies in function of j.
how can I write it?
Code:
Sub tratar()
Dim endereço() As Range
uLinha = Range("B1048576").End(xlUp).Row 'última linha
i = 24
Do Until i = uLinha
If trat.Range("B" & i) = "NOTA" Then
trat.Range("B" & i).Select
'determinando quantos "tipos" tem no current region
Selection.CurrentRegion.Select
Selection.Find(What:="tipo", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
lprim = ActiveCell.Row 'linha da 1a celula ativa
Do
j = j + 1 'quantidade de "tipo"
Selection.FindNext(After:=ActiveCell).Activate
endereço(j) = ActiveCell.address
Loop While ActiveCell.Row > lprim