Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
If Not Intersect(Target, Range("C6")) Is Nothing Then
Call CLICK_BTN_INFOS_CONTRAT
End If
Dim TabRes() As String
If Target.Value = [E15].Value Then
ReDim TabRes(0 To UBound(Split([Target], ",")))
For i = LBound(TabRes) To UBound(TabRes)
TabRes(i) = Split(Split([Target], ",")(i), "-")(1)
Next i
End If
MsgBox TabRes(0)
GET_GROUPE_GESTION_CIBLE TabRes(0)
End Sub
Public Sub GET_GROUPE_GESTION_CIBLE(ByRef strQ As String)
Dim cnn_Pegase As ADODB.Connection 'Connexion Pegase
Dim RECSET As New ADODB.Recordset
Call CONNEXION_PEG("select", "test", "PEG")
RECSET.Open "select serv.lb_long||' (AT: '||pers.s_nom||' '||pers.s_prenom||')' as groupecible from db_tiers as ti, dr_collaborateur_tiers cp,db_collaborateur col,db_personne pers,dr_service_collaborateur sc,db_service_compagnie serv" & _
" where ti.CD_TIERS='" & strQ & "' ti.is_tiers=cp.is_tiers and cp.is_collaborateur = col.is_collaborateur and col.is_personne = pers.is_personne and col.is_collaborateur = sc.is_collaborateur and sc.is_service_compagnie = serv.is_service_compagnie", cnn_Pegase, adOpenDynamic, adLockBatchOptimistic
If Not RECSET.EOF Then
Worksheets("1 - Feuille de Suivi Commercial").Range("GET_GROUPE_GESTION_CIBLE").Value = RECSET.Fields("groupecible").Value
Else
Worksheets("1 - Feuille de Suivi Commercial").Range("GET_GROUPE_GESTION_CIBLE").Value = "Inconnu"
End If
RECSET.Close
Call DECONNEXION_PEG
End Sub