Procv help to select data

0

I have a database where an employee has three or more dependents, when I make a PROCV to pull one dependent at a time, only the first and last one appears.

=PROCV(B35;'SÓCIOS COOP'!C:G;5;1)

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         Filho   BRUNO 

216 WILLIAN         Filho   LUIS 

216 WILLIAN         Filho   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         Filho    BRUNO  Filho   YASMIN 
    
asked by anonymous 02.08.2017 / 14:28

1 answer

0

Good Night,

I made a code, but it is not copying to the upload folder ... can anyone help me.

Thanks for the help right away.

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
    
03.08.2017 / 01:54