Sub sélection()
With ActiveSheet 'Feuil1 'CodeName
If .FilterMode Then .ShowAllData 'si la feuille est filtrée
.Columns(16).Validation.Delete 'RAZ
With .Rows("6:" & .Range("j" & .Rows.Count).End(xlUp).Row)
If .Row < 6 Then Exit Sub 'sécurité
Application.ScreenUpdating = False
.Rows.RowHeight = 55
.Sort .Columns(10), xlAscending, Header:=xlNo 'tri
Union(.Rows(0), .Rows).AutoFilter 10, "RDV Fait" 'filtre automatique
On Error Resume Next 'si aucune SpecialCell
With Intersect(.SpecialCells(xlCellTypeVisible), .Columns(16))
Application.Goto .Cells(1), True 'sélectionne et cadre la 1ère cellule visible en colonne P
.Validation.Add xlValidateList, Formula1:="Validé,Annulé"
End With
ActiveWindow.ScrollColumn = 1
'.AutoFilter 'ôte le filtre
End With
End With
ActiveCell.Offset(0, -6).Select
ActiveCell.FormulaR1C1 = "=""RdV Fait ""&RC[6]"
ActiveCell.Copy
Range(ActiveCell.Offset(1, 0), Cells(Rows.Count, "j").End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(-1, 0).Select
End Sub
Sub Affiche()
' 'validation NON
Selection.AutoFilter 'ôte le filtre
Columns("J:J").Select
Selection.Find(What:="RdV Fait", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(ActiveCell.Offset(0, 0), Cells(Rows.Count, "j").End(xlUp)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
[p:p] = ""
With [p:p].Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Application.CutCopyMode = False
'[a1].Select
End Sub