1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim Plage As Range, GP As Integer
If Sh.Name = "Commande 1" Then
GP = 1
ElseIf Sh.Name = "Commande 2" Then
GP = 2
Else
Exit Sub
End If
With Sheets("Rooming")
.AutoFilterMode = False
Set Plage = .Range(.[A8], .Cells(.Rows.Count, 1).End(xlUp)).Resize(, 19)
Plage.AutoFilter 1, GP
Set Plage = Plage.Resize(Plage.Rows.Count - 1).Offset(1, 1)
If Application.Subtotal(103, Plage) > 0 Then
With Sh
Set Plage = Plage.SpecialCells(xlCellTypeVisible)
Plage.Columns(1).Copy Sh.[A5]
Plage.Columns(2).Copy Sh.[B5]
Plage.Columns(4).Copy Sh.[C5]
Plage.Columns(13).Copy Sh.[D5]
Plage.Columns(16).Copy Sh.[E5]
Plage.Columns(17).Copy Sh.[F5]
Plage.Columns(18).Copy Sh.[G5]
End With
End If
End With
End Sub |
Partager