1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| nbPageBr = Activesheet.HPageBreaks.Count
For I = 1 To nbPageBr
For J = Activesheet.HPageBreaks(I).Location.Row - 1 To 3 Step -1
If InStr(1, Range("A" & J), "expédier") > 0 Then
Set Activesheet.HPageBreaks(I).Location = Range("A" & J)
Exit For
End If
Next
Next
If nbPageBr < Activesheet.HPageBreaks.Count Then 'vérifier si c'a changé...
nbPageBr = Activesheet.HPageBreaks.Count
For J = Activesheet.HPageBreaks(nbPageBr).Location.Row - 1 To 3 Step -1
If InStr(1, Range("A" & J), "expédier") > 0 Then
Set Activesheet.HPageBreaks(nbPageBr).Location = Range("A" & J)
Exit For
End If
Next
End If |