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
|
Option Explicit
Public R As Range
Sub RechercheSelect(ByVal FeuilleBonAchat As Worksheet, TitreFeuille As Long, ByVal NumeroBonAchat As Variant)
Dim AireBonAchat As Range
Dim C As Range
Dim DerniereLigne As Long
Application.ScreenUpdating = False
With FeuilleBonAchat
DerniereLigne = .Cells(.Rows.Count, 1).End(xlUp).Row
Set AireBonAchat = .Range(.Cells(TitreFeuille + 1, 1), .Cells(DerniereLigne, 1))
For Each C In AireBonAchat
If C = NumeroBonAchat Then
If R Is Nothing Then
Set R = Range(C.Offset(0, 7), C.Offset(0, 10))
Else
Set R = Application.Union(R, Range(C.Offset(0, 7), C.Offset(0, 10)))
End If
End If
Next C
Set AireBonAchat = Nothing
End With
Application.ScreenUpdating = True
End Sub |
Partager