maval
XLDnaute Barbatruc
Bonjour,
J'aimerais savoir si possible d'interdire l'ouverture d'un userform en cochant un checkBox ?
en sachant que l'Userform et ouvert par une shappe avec ce code
Je vous remercie d'avance.
J'aimerais savoir si possible d'interdire l'ouverture d'un userform en cochant un checkBox ?
en sachant que l'Userform et ouvert par une shappe avec ce code
Code:
'=======Parti de L'Userf==========
choix = Format(CStr([c2]), "00")
ActiveSheet.Shapes("US-" & choix).Fill.ForeColor.SchemeColor = 4
If ActiveSheet.CheckBox1.Value = True Then
Pref = LTrim(Replace(ActiveSheet.Shapes("US-" & choix).TextFrame2.TextRange.Characters.Text, vbLf, ""))
Pref = LTrim(Mid(Pref, 3))
Sheets(Pref).Visible = True
Sheets(Pref).Activate
End If
For Each sh In Sheets
If sh.Name <> "Etats_Unis" And sh.Name <> "Bd" And sh.Name <> Pref Then '"Feuil3" And sh.Name <> Pref Then
sh.Visible = False
End If
Next
With Feuil2
Set cel = .Columns(2).Find(Feuil1.Range("c2"), , , xlWhole)
If Not cel Is Nothing Then lig = cel.Row
End With
With UserEtats_Unis
.T2 = Feuil2.Cells(lig, 4): .T3 = Feuil2.Cells(lig, 3): .T4 = Feuil2.Cells(lig, 2): .T1 = Feuil2.Cells(lig, 2)
For i = 5 To 11
.Controls("T" & i) = Feuil2.Cells(lig, i)
Next i
.Show 0
'Stop
'Code pour avoir le rafraichissement des textbox
With UserEtats_Unis
.T2 = Feuil2.Cells(lig, 4): .T3 = Feuil2.Cells(lig, 3): .T4 = Feuil2.Cells(lig, 1): .T1 = Feuil2.Cells(lig, 2)
For i = 5 To 17
.Controls("T" & i) = Feuil2.Cells(lig, i)
Next i
.UserForm_Activate
.Show 0
End With
Je vous remercie d'avance.
Dernière édition: