Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tablo, d As Object, i&
With [A3].CurrentRegion
.Sort .Cells(1), xlAscending, Header:=xlYes 'tri sur les dates
tablo = .Resize(, 2) 'matrice, plus rapide, au moins 2 éléments
End With
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
If IsDate(tablo(i, 1)) Then d(Application.WeekNum(tablo(i, 1), 2)) = ""
Next
With [G1].Validation
.Delete
If d.Count = 0 Then Exit Sub
.Add xlValidateList, Formula1:=Join(d.keys, ",")
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [G1]) Is Nothing Then Exit Sub
Dim sem As Byte, i&
sem = [G1] 'critère
Application.ScreenUpdating = False
If FilterMode Then ShowAllData 'si la feuille est filtrée
With [A3].CurrentRegion
.Rows.Hidden = False
For i = 2 To .Rows.Count
If sem And IsDate(.Cells(i, 1)) Then If (Application.WeekNum(.Cells(i, 1), 2)) <> sem Then .Rows(i).Hidden = True
Next
End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tablo, d As Object, i&, a
tablo = [A3].CurrentRegion.Resize(, 2) 'matrice, plus rapide, au moins 2 éléments
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
If IsDate(tablo(i, 1)) Then d(Application.WeekNum(tablo(i, 1), 2)) = ""
Next
With [G1].Validation
.Delete
If d.Count = 0 Then Exit Sub
a = d.keys
tri a, 0, UBound(a)
.Add xlValidateList, Formula1:=Join(a, ",")
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [G1]) Is Nothing Then Exit Sub
Dim sem As Byte, i&
sem = [G1] 'critère
Application.ScreenUpdating = False
If FilterMode Then ShowAllData 'si la feuille est filtrée
With [A3].CurrentRegion
.Rows.Hidden = False
For i = 2 To .Rows.Count
If sem And IsDate(.Cells(i, 1)) Then If (Application.WeekNum(.Cells(i, 1), 2)) <> sem Then .Rows(i).Hidden = True
Next
End With
End Sub
Sub tri(a, gauc, droi) ' Quick sort
Dim ref, g, d, temp
ref = a((gauc + droi) \ 2)
g = gauc: d = droi
Do
Do While a(g) < ref: g = g + 1: Loop
Do While ref < a(d): d = d - 1: Loop
If g <= d Then
temp = a(g): a(g) = a(d): a(d) = temp
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call tri(a, g, droi)
If gauc < d Then Call tri(a, gauc, d)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [G1]) Is Nothing Then Exit Sub
[F4] = "=OR(WEEKNUM(A4,2)=G$1,G$1=0)" 'critère
[A3].CurrentRegion.AdvancedFilter xlFilterInPlace, [F3:F4]
[F4] = ""
End Sub
Qui ne fonctionnent pas sur 2010, sa version, contrairement à WEEKNUM(A4,21)Inscrit depuis 2008, mcj1997 a sûrement entendu parler de ISOWEEKNUM/NO.SEMAINE.ISO.