Re : Checbox....
Le Fil,
Voici mon code dans l'usf recherche pour alimenter en fonction d'une TextBox (recherche par nom) dans une bdd d'autres Textbox et donner ainsi les infos de la ligne correspondante:
Private Sub CommandButton1_Click()
Dim cel As Range
If TextBox23 = "" Then
MsgBox " Le Nom de l'acheteur est obligatoire . "
Exit Sub
Else
Label44.Caption = "Recherche de " & TextBox23
Worksheets("Base de Données acheteurs").Activate
Set cel = Range("A1")
Set cel = Columns(1).Find(What:=TextBox23, After:=cel, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not cel Is Nothing Then
L = cel.Row
Label45.Caption = "éxiste déjà " & L
TextBox24 = Cells(L, "B")
TextBox25 = Cells(L, "C")
TextBox26 = Cells(L, "D")
TextBox27 = Cells(L, "E")
TextBox28 = Cells(L, "F")
TextBox29 = Cells(L, "G")
TextBox30 = Cells(L, "H")
TextBox31 = Cells(L, "I")
TextBox32 = Cells(L, "J")
TextBox33 = Cells(L, "K")
TextBox34 = Cells(L, "L")
TextBox35 = Cells(L, "M")
TextBox36 = Cells(L, "N")
TextBox37 = Cells(L, "O")
TextBox38 = Cells(L, "P")
TextBox39 = Cells(L, "Q")
TextBox40 = Cells(L, "R")
TextBox41 = Cells(L, "S")
TextBox42 = Cells(L, "T")
TextBox43 = Cells(L, "U")
TextBox44 = Cells(L, "V")
TextBox45 = Cells(L, "W")
TextBox46 = Cells(L, "X")
TextBox47 = Cells(L, "Y")
TextBox48 = Cells(L, "Z")
TextBox49 = Cells(L, "AA")
TextBox50 = Cells(L, "AB")
TextBox51 = Cells(L, "AC")
TextBox52 = Cells(L, "AD")
TextBox53 = Cells(L, "AE")
TextBox54 = Cells(L, "AF")
TextBox55 = Cells(L, "AG")
TextBox56 = Cells(L, "AH")
TextBox57 = Cells(L, "AI")
TextBox58 = Cells(L, "AJ")
TextBox59 = Cells(L, "AK")
Sheets("ImprimFicheAcheteur").Range("B8") = TextBox23
Sheets("ImprimFicheAcheteur").Range("F8") = Cells(L, "C")
Sheets("ImprimFicheAcheteur").Range("F13") = Cells(L, "G")
Sheets("ImprimFicheAcheteur").Range("C11") = Cells(L, "P")
Sheets("ImprimFicheAcheteur").Range("B1") = Cells(L, "Q")
Sheets("ImprimFicheAcheteur").Range("C24") = Cells(L, "W")
Sheets("ImprimFicheAcheteur").Range("C26") = Cells(L, "U")
Sheets("ImprimFicheAcheteur").Range("C25") = Cells(L, "S")
Sheets("ImprimFicheAcheteur").Range("C27") = Cells(L, "T")
Sheets("ImprimFicheAcheteur").Range("C28") = Cells(L, "V")
Sheets("ImprimFicheAcheteur").Range("C29") = Cells(L, "Y")
Sheets("ImprimFicheAcheteur").Range("C30") = Cells(L, "AJ")
Sheets("ImprimFicheAcheteur").Range("B13") = Cells(L, "H")
Sheets("ImprimFicheAcheteur").Range("B14") = Cells(L, "I")
Sheets("ImprimFicheAcheteur").Range("B15") = Cells(L, "J")
Sheets("ImprimFicheAcheteur").Range("B16") = Cells(L, "K")
Sheets("ImprimFicheAcheteur").Range("B17") = Cells(L, "L")
Sheets("ImprimFicheAcheteur").Range("B18") = Cells(L, "M")
Sheets("ImprimFicheAcheteur").Range("B19") = Cells(L, "N")
Sheets("ImprimFicheAcheteur").Range("B20") = Cells(L, "O")
Sheets("ImprimFicheAcheteur").Range("F2") = Cells(L, "AI")
Sheets("ImprimFicheAcheteur").Range("F1") = Cells(L, "F")
Sheets("ImprimFicheAcheteur").Range("C3") = Cells(L, "R")
Sheets("ImprimFicheAcheteur").Range("C4") = Cells(L, "AG")
Sheets("ImprimFicheAcheteur").Range("C5") = Cells(L, "AE")
Sheets("ImprimFicheAcheteur").Range("C6") = Cells(L, "AF")
Sheets("ImprimFicheAcheteur").Range("A32") = Cells(L, "AK")
Else
MsgBox "Pas trouvé"
TextBox23 = ""
TextBox23.SetFocus
End If
'End With
End If
TextBox23 = ""
End Sub
Comment puis-je au travers de ce code remplacer:
TextBox48 = Cells(L, "Z")
par une ChecBox, qui si dans colonne z, à la ligne concernée, la valeur est "Oui" alors, la CheckBox est cliqué car vrai!
Voir aussi exemple d'une discussion ramennée plus haut avec pierrejean dans un autre fil!
merci d'avance, je sèche grave!