I have a database in which an employee has three or more dependents, when I do a PROCV to pull a dependent one at a time, only the first and last one appears.
How do I select the first in a column the second in another column and so on?
EXAMPLE
I have these values in the database:
216 WILLIAN Son BRUNO
216 WILLIAN Son LUIS
216 WILLIAN Son YASMIN
I made a PROCV in another worksheet to leave a parent and in other columns the children, I was able to pull through PROCV the first child and the last one. But I can not pull the middle child.
216 WILLIAN Son BRUNO Son YASMIN
I also made a code that I believe is correct in logic, but I can not get it to copy data from one folder to another ...
Sub limpar()
Dim num As Integer
Dim contChave, contPrincipal As Integer
Dim numDependente As Integer
Dim idAtual As Integer
contPrincipal = 2
contChave = 2
Sheets("Chave").Select
Cells(contChave, 2).Select
Do While ActiveCell.Value <> ""
num = ActiveCell.Value
numDependente = 0
Sheets("SÓCIOS COOP").Select
idAtual = Cells(contPrincipal, 3).Value
Do While num = idAtual
numDependente = numDependente + 1
Set depAtual = Range(Cells(contPrincipal, 6), Cells(contPrincipal, 8))
Sheets("Chave").Select
Set depend = Range(Cells(contChave, (1 + numDependentes * 3)), Cells(contChave, (1 + numDependentes * 3 + 2)))
depAtual.Copy depend
contPrincipal = contPrincipal + 1
Sheets("SÓCIOS COOP").Select
Cells(contPrincipal, 3).Select
idAtual = ActiveCell.Value
Loop
contChave = contChave + 1
Sheets("Chave").Select
Cells(contChave, 2).Select
Loop
End Sub