enregistrer listindex si

BLS77

XLDnaute Junior
bonsoir à tous

j'ai encore besoin de vous

j'ai deux combox chevauché une des deux s'affiche selon une condition par contre il faut que j'enregistre la valeur de la liste index de celui qui est afficher
j'ai fais de cette facon mais ca ne marche pas il n ya rien qui s'enregistre
quelqu'un à une idées d'ou ca viens svp
Code:
Dim fin As Long
Dim haute As Integer
Verif1
If deja = True Then Exit Sub
fin = finf11 + 1
haute = trans.Cells(nohote, 1)
Feuil11.Cells(fin, 1) = CDate(Now): Feuil11.Cells(fin, 1).NumberFormat = "dd/mm/yyyy"
Feuil11.Cells(fin, 2) = nohote
Feuil11.Cells(fin, 3) = CDate(TxtDate): Feuil11.Cells(fin, 3).NumberFormat = "dd/mm/yyyy"
Feuil11.Cells(fin, 4) = Réf
Feuil11.Cells(fin, 5) = TypeSignalement.List(TypeSignalement.ListIndex, 0)
Feuil11.Cells(fin, 6) = plate.List(plate.ListIndex, 0)
Feuil11.Cells(fin, 7) = Auteur
Feuil11.Cells(fin, 8) = TxtNom
Feuil11.Cells(fin, 9) = Clé
Feuil11.Cells(fin, 10) = NbAdultes
Feuil11.Cells(fin, 11) = Nbenfants
Feuil11.Cells(fin, 12) = Total.Caption
Feuil11.Cells(fin, 13) = Capacité
Feuil11.Cells(fin, 14) = numchbre
Feuil11.Cells(fin, 15) = ""
Feuil11.Cells(fin, 16) = surr.Caption
Feuil11.Cells(fin, 17) = Déscription
Feuil11.Cells(fin, 19) = TyppologieMe.List(TyppologieMe.ListIndex, 0)
Feuil11.Cells(fin, 20) = StatutDemande.List(StatutDemande.ListIndex, 0)
Feuil11.Cells(fin, 21) = StatutInter.List(StatutInter.ListIndex, 0)
Feuil11.Cells(fin, 22) = TypeInterv.List(TypeInterv.ListIndex, 0)
If TypeSignalement.ListIndex = 1 Then
Feuil11.Cells(fin, 18) = TeamVer
Else
If TypeSignalement.ListIndex = 2 Then
Feuil11.Cells(fin, 18) = TeamMe
End If
If DateVisite = Not Empty Then
Feuil11.Cells(fin, 23) = CDate(DateVisite): Feuil11.Cells(fin, 23).NumberFormat = "dd/mm/yyyy"
End If
Unload Me
End If
 

Banzai64

XLDnaute Accro
Re : enregistrer listindex si

Re

Pas facile à te suivre

As-tu fais un mode pas-à-pas ?
ta variable deja est elle réinitialisée avant l'appel de Verif1 ?

Essayes ça

Code:
Dim fin As Long
Dim haute As Integer
[COLOR="Red"]deja=FALSE[/COLOR]
Verif1
If deja = True Then Exit Sub
fin = finf11 + 1
haute = trans.Cells(nohote, 1)

Non inutile je viens de (re)voir

https://www.excel-downloads.com/threads/verification-de-lexistance-de-la-reference.152716/

Donc il y a autre chose mais comme ça je ne vois pas

désolé
 
Dernière édition:

BLS77

XLDnaute Junior
Re : enregistrer listindex si

re bonsoir le forum
Oui benzai64
il n' ya plus de souci la dessus surtout sur mon sub verif1 deja=false
Code:
Sub Verif1()
Dim x, travv
deja = False
travv = DepTraitements.Réf.Caption
With Feuil11
For x = 1 To finf11
If .Cells(x, 2) = nohote And .Cells(x, 4) = travv Then mess_13: deja = True: Exit Sub
Next
End With
End Sub
donc pas de souci mais la ou ca coince je vais les mettre en rouge
Code:
Private Sub BtnValider_Click()
Dim fin As Long
Dim haute As Integer
Verif1
If deja = True Then Exit Sub
fin = finf11 + 1
haute = trans.Cells(nohote, 1)
Feuil11.Cells(fin, 1) = CDate(Now): Feuil11.Cells(fin, 1).NumberFormat = "dd/mm/yyyy"
Feuil11.Cells(fin, 2) = nohote
Feuil11.Cells(fin, 3) = CDate(TxtDate): Feuil11.Cells(fin, 3).NumberFormat = "dd/mm/yyyy"
Feuil11.Cells(fin, 4) = Réf
Feuil11.Cells(fin, 5) = TypeSignalement.List(TypeSignalement.ListIndex, 0)
Feuil11.Cells(fin, 6) = plate.List(plate.ListIndex, 0)
Feuil11.Cells(fin, 7) = Auteur
Feuil11.Cells(fin, 8) = TxtNom
Feuil11.Cells(fin, 9) = Clé
Feuil11.Cells(fin, 10) = NbAdultes
Feuil11.Cells(fin, 11) = Nbenfants
Feuil11.Cells(fin, 12) = Total.Caption
Feuil11.Cells(fin, 13) = Capacité
Feuil11.Cells(fin, 14) = numchbre
Feuil11.Cells(fin, 15) = ""
Feuil11.Cells(fin, 16) = surr.Caption
Feuil11.Cells(fin, 17) = Déscription
Feuil11.Cells(fin, 19) = TyppologieMe.List(TyppologieMe.ListIndex, 0)
Feuil11.Cells(fin, 20) = StatutDemande.List(StatutDemande.ListIndex, 0)
Feuil11.Cells(fin, 21) = StatutInter.List(StatutInter.ListIndex, 0)
Feuil11.Cells(fin, 22) = TypeInterv.List(TypeInterv.ListIndex, 0)
[COLOR="Red"]If TypeSignalement.ListIndex = 1 Then
Feuil11.Cells(fin, 18) = TeamVer
Else
If TypeSignalement.ListIndex = 2 Then
Feuil11.Cells(fin, 18) = TeamMe
End If
If DateVisite = Not Empty Then
Feuil11.Cells(fin, 23) = CDate(DateVisite): Feuil11.Cells(fin, 23).NumberFormat = "dd/mm/yyyy"
End If[/COLOR]Unload Me
End If
End Sub
 

BLS77

XLDnaute Junior
Re : enregistrer listindex si

re le forum
merci benzai64
j'ai d'une autre facon la fonction
Code:
Private Sub BtnValider_Click()
Dim fin As Long
Dim haute As Integer
Verif1
If deja = True Then Exit Sub
fin = finf11 + 1
haute = trans.Cells(nohote, 1)
Feuil11.Cells(fin, 1) = CDate(Now): Feuil11.Cells(fin, 1).NumberFormat = "dd/mm/yyyy"
Feuil11.Cells(fin, 2) = nohote
Feuil11.Cells(fin, 3) = CDate(TxtDate): Feuil11.Cells(fin, 3).NumberFormat = "dd/mm/yyyy"
Feuil11.Cells(fin, 4) = Réf
Feuil11.Cells(fin, 5) = TypeSignalement.List(TypeSignalement.ListIndex, 0)
Feuil11.Cells(fin, 6) = plate.List(plate.ListIndex, 0)
Feuil11.Cells(fin, 7) = Auteur
Feuil11.Cells(fin, 8) = TxtNom
Feuil11.Cells(fin, 9) = Clé
Feuil11.Cells(fin, 10) = NbAdultes
Feuil11.Cells(fin, 11) = Nbenfants
Feuil11.Cells(fin, 12) = Total.Caption
Feuil11.Cells(fin, 13) = Capacité
Feuil11.Cells(fin, 14) = numchbre
Feuil11.Cells(fin, 15) = ""
Feuil11.Cells(fin, 16) = surr.Caption
Feuil11.Cells(fin, 17) = Déscription
Feuil11.Cells(fin, 19) = TyppologieMe.List(TyppologieMe.ListIndex)
Feuil11.Cells(fin, 20) = StatutDemande.List(StatutDemande.ListIndex)
Feuil11.Cells(fin, 21) = StatutInter.List(StatutInter.ListIndex)
Feuil11.Cells(fin, 22) = TypeInterv.List(TypeInterv.ListIndex)
Feuil11.Cells(fin, 24) = VerifTerrain.Caption
If TypeSignalement.Text = "VERIFICATION" Then
Feuil11.Cells(fin, 18) = TeamVer.List(TeamVer.ListIndex)
Else
If TypeSignalement.Text = "MEDIATION" Then
    Feuil11.Cells(fin, 18) = TeamMe.List(TeamMe.ListIndex)
End If
    If DateVisite = Not Empty Then
    Feuil11.Cells(fin, 23) = CDate(DateVisite): Feuil11.Cells(fin, 23).NumberFormat = "dd/mm/yyyy"
End If
Unload Me
End If
End Sub
j'ai remplacer list par text
 

Discussions similaires

Statistiques des forums

Discussions
312 343
Messages
2 087 442
Membres
103 546
dernier inscrit
mohamed tano