Option Explicit
Private Sub Worksheet_Activate()
Dim C As Range
Application.ScreenUpdating = False
For Each C In [planning2]
C.Interior.ColorIndex = xlNone
On Error Resume Next
C.Interior.ColorIndex = [activité].Find(C, LookAt:=xlWhole).Interior.ColorIndex
Next C
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static sem$, cel As Range, nbcol As Long
Application.ScreenUpdating = False
sem = ActiveCell.Value
If ActiveCell.Row <> 2 Then
MsgBox ("Vous devez sélectionner le numéro de semaine en ligne 2")
Exit Sub
End If
nbcol = 6
Set cel = ActiveCell.MergeArea
If ActiveCell.Column = 2 Then: nbcol = 3: cel = sem
Sheets("Print").Columns("B:H").Delete
Range(Cells(2, ActiveCell.Column), Cells(23, ActiveCell.Column + nbcol)).Copy Sheets("Print").Range("B1")
Sheets("Print").PrintPreview
End Sub