Bonjour le forum,
Serait possible de m'expliquer comment faire pour exécuter ces 2 macros à la suite.
Séparément, les 2 fontionnent parfaitement.
Serait possible de m'expliquer comment faire pour exécuter ces 2 macros à la suite.
Séparément, les 2 fontionnent parfaitement.
Code:
Private Sub CommandButton1_Click() 'macro couper coller suivant conditions
Dim plage As Range, c As Range, cSource As Range
Set plage = Feuil2.Range("B1:O55")
Application.ScreenUpdating = False
For Each c In plage
If Not IsEmpty(c) Then 'And Not c.Locked
Set cSource = Sheets("BD").UsedRange.Find(what:=c, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
If Not cSource Is Nothing Then
If cSource.Offset(0, 5).Value = 7 Then
c.Copy Destination:=Sheets("Plan N").Range("U" & _
Application.Rows.Count).End(xlUp)(2)
c.Clear
c.Locked = False
End If
End If
End If
Next c
Application.ScreenUpdating = True
'puis
Dim plage As Range, c As Range, cSource As Range
Set plage = Feuil2.Range("P1:S55")
Application.ScreenUpdating = False
For Each c In plage
If Not IsEmpty(c) Then 'And Not c.Locked
Set cSource = Sheets("BD").UsedRange.Find(what:=c, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
If Not cSource Is Nothing Then
If cSource.Offset(0, 5).Value = 7 Then
c.Copy Destination:=Sheets("Plan N").Range(c.Address)
c.Clear
c.Locked = False
End If
End If
End If
Next c
Application.ScreenUpdating = True
End Sub