Private Sub CommandButton1_Click()
Dim mySheet As Worksheet
myPage = MultiPage1.Value
Set mySheet = IIf(myPage = 0, Worksheets('Private'), Worksheets('Public'))
With mySheet
myLine = .Range('A65000').End(xlUp).Row + 1
myEntity = IIf(myPage = 0, ComboBox11.Value, ComboBox21.Value)
myRabais = IIf(myPage = 0, TextBox12.Value, TextBox22.Value)
.Cells(myLine, 3) = myEntity
.Cells(myLine, 5) = myRabais
'etc.'
End With
Unload Me
End Sub
Private Sub CommandButton10_Click()
Dim mySheet As Worksheet
Msg = MsgBox('Attention, vous êtes sur le point de changer des données !', vbOKCancel + vbExclamation)
If Msg = vbCancel Then Exit Sub
myPage = MultiPage1.Value
Set mySheet = IIf(myPage = 0, Worksheets('Private'), Worksheets('Public'))
myLine = 2 + IIf(myPage = 0, ListBox1.ListIndex, ListBox2.ListIndex)
With mySheet
myEntity = IIf(myPage = 0, ComboBox11.Value, ComboBox21.Value)
myRabais = IIf(myPage = 0, TextBox12.Value, TextBox22.Value)
.Cells(myLine, 3) = myEntity
.Cells(myLine, 5) = myRabais
'etc.'
End With
Unload Me
End Sub