L
Lectave
Guest
Bonjour à tous,
je bricole depuis quelques temps des macros. Par défaut de connaissances grammaticales et orthographiques, j'écris des codes qui s'allongent ...
Pouvez vous m'aider à simplifier le code suivant (USF avec plusieurs checkbox et textbox):
' Initialisation du USF
Private Sub UserForm_Activate()
If Cells(i + 3, 26).Value = 1 Then CheckBox5 = True
If Cells(i + 3, 26).Value = 0 Then CheckBox5 = False
If Cells(i + 3, 27).Value = 1 Then CheckBox6 = True
If Cells(i + 3, 27).Value = 0 Then CheckBox6 = False
[...] idem jusqu'au checkbox44
If Cells(i + 3, 65).Value = 1 Then CheckBox44 = True
If Cells(i + 3, 65).Value = 0 Then CheckBox44 = False
TextBox1.Value = Cells(i + 3, 66).Value
[...] idem jusqu'au textbox20
TextBox20.Value = Cells(i + 3, 85).Value
End Sub
Merci bcp
je bricole depuis quelques temps des macros. Par défaut de connaissances grammaticales et orthographiques, j'écris des codes qui s'allongent ...
Pouvez vous m'aider à simplifier le code suivant (USF avec plusieurs checkbox et textbox):
' Initialisation du USF
Private Sub UserForm_Activate()
If Cells(i + 3, 26).Value = 1 Then CheckBox5 = True
If Cells(i + 3, 26).Value = 0 Then CheckBox5 = False
If Cells(i + 3, 27).Value = 1 Then CheckBox6 = True
If Cells(i + 3, 27).Value = 0 Then CheckBox6 = False
[...] idem jusqu'au checkbox44
If Cells(i + 3, 65).Value = 1 Then CheckBox44 = True
If Cells(i + 3, 65).Value = 0 Then CheckBox44 = False
TextBox1.Value = Cells(i + 3, 66).Value
[...] idem jusqu'au textbox20
TextBox20.Value = Cells(i + 3, 85).Value
End Sub
Merci bcp