Private Sub CommandButton_valider_Click()
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim Plage1 As Range, Cell1 As Range
Dim Plage2 As Range, Cell2 As Range
Dim CTRL As Control
Dim X As Byte
Set WS1 = ThisWorkbook.Worksheets("BDD")
Set Plage1 = WS1.Range("A5:A370")
Set WS2 = ThisWorkbook.Worksheets("BDD")
Set Plage2 = WS2.Range("A506:A871")
For Each Cell1 In Plage1
If Cell1.Offset(0, 1) = "REM" Then
Cell1.Offset(0, 1) = ""
End If
Next Cell1
For Each Cell2 In Plage2
If Cell2.Offset(0, 2) = "REM" Then
Cell2.Offset(0, 2) = ""
End If
Next Cell2
For Each CTRL In Me.Controls
If Left(CTRL.Name, 7) = "TextBox" Then
If Right(CTRL.Name, 1) = X Then
If CTRL <> "" Then
If IsDate(CTRL) = True Then
For Each Cell1 In Plage1
If CDate(Cell1.Value) = CDate(CTRL) Then
Cell1.Offset(0, 1) = "REM"
End If
Next Cell1
'second passage pour feuille "Poste" (écriture en colonne "C")
For Each Cell2 In Plage2
If CDate(Cell2.Value) = CDate(CTRL) Then
Cell2.Offset(0, 2) = "REM"
End If
Next Cell2
End If
End If
X = X + 1
End If
End If
Next CTRL
MAJ_USF
'Unload UserForm_remonte
'Unload UserForm_aperçu
'UserForm_aperçu.Show
End Sub