bonjour,
Tu peux essayer comme ça :
Private Sub Image2_Click()
Dim i%
'An = Format(Date, "yy")
If IsDate(TextBox1) = False Then
MsgBox "Date incorrecte.", 16
TextBox1.SetFocus 'place le curseur dans la TextBox1
TextBox1.SelStart = 0 'début de la sélection
TextBox1.SelLength = Len(Me.TextBox1.Value) 'longueur de la sélection
Exit Sub
End If
dte = CDate(TextBox1)
N°Sem = DatePart("ww", DateSerial(Year(dte), Month(dte), Day(dte)), 2, 2)
'Flag = 0
For Each f In Worksheets
If f.Name = Format(N°Sem, "00-") & Format(dte, "yy") Then
Sheets(Format(N°Sem, "00-") & Format(dte, "yy")).Select
i = DateSerial(Year(dte), Month(dte), Day(dte)) - DateSerial(Year([B2]), Month([B2]), Day([B2]))
Range("h1") = ""
Range("h1") = TextBox1
Range(Cells(2, i + 2), Cells(61, i + 2)).Select
Exit For
'End
End If
Next f
'If flag = 0 Then
' Sheets("Modele").Visible = True
' Sheets("Modele").Copy After:=Sheets(Sheets.Count)
' 'ActiveSheet.Name = Format(N°Sem, "00-") & An
' ActiveSheet.Name = Format(N°Sem, "00-") & Format(dte, "yy")
' Sheets("Modele").Visible = False
' If Weekday(dte) = 1 Then Range("E1") = CDate(dte) - 6
' If Weekday(dte) > 1 Then Range("E1") = CDate(dte) - Weekday(CDate(dte)) + 2
Unload Me
End Sub
A+