-3
I have two combobox, the first is the managers and the second I have the coordinators.
MANAGER - FABIO - ADRIANA - LEANDRO
COORDINATORS - TEREZA - GERALDO - GABRIELE - JOICE - VALDIR -ROSE - KATIA -LUCIA - PAULO - REBECA
When I select in the manager combo Fabio In the coordinator combo will have to show GABRIELE - LUCIA TEREZA
When I select in the combo manager LEANDRO In the coordinator combo will have to show GERALDO - REBECA - JOICE
When I select in the manager combo Adriana In the coordinator combo will have to show KATIA - PAULO - VALDIR
Sub PreencherComboboxCoord()
Dim wsc As Worksheet
Dim wsr As Worksheet
Dim celula As Range
Dim NGerente As String
Set wsc = Sheets("Custos de 01 a 1310")
Set wsr = Sheets("Resultado")
wsc.Select
wsc.Range("M2").Select 'Coordenador
With Planilha3
NGerente = .Cbo_Gerente.Value
.Cbo_Coordenador.Clear
End With
Do
With PlanCusto ' planilha onde vou extrair os dados
On Error Resume Next
Pesquisa = .Range("M2").Address & ":" & ActiveCell.Address
contar = WorksheetFunction.CountIf(.Range(Pesquisa), ActiveCell.Text)
With Planilha3 ' Resultado onde está as combox
If contar <= 1 Then
If PlanCusto.Range(Pesquisa) = NGerente Then
.Cbo_Coordenador.AddItem ActiveCell.Text
End If
End If
End With
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value = Empty Then
wsr.Select
Exit Sub
End If
End With
Loop
In other words, every manager has their coordinators, and it’s this relationship that I’m not having.
I await grateful return