BERRACHED said
XLDnaute Accro
Bonjour le forum
voila avec votre aide j'ai pu corriger le code qui cherche entre deux dates et ca marcher bien mais seulement quand ma base de donnes c a dire sheets("BD") a commencer a prendre de l'ampleur en cumulant les enregistrements le code a encore une fois foiré je ne sais pas si c'est du a la taille ou autre chose voila le bout de code :
Private Sub CommandButton1_Click()
Dim startRow As Integer, stopRow As Integer, d1 As Range, d2 As Range
On Error GoTo message
If StartDate = "" Then MsgBox "Veuillez entrer Une Date Svp"
StartDate = Format(StartDate, "dd/mm/yyyy")
If StopDate = "" Then MsgBox "une date de fin Svp"
StopDate = Format(StopDate, "dd/mm/yyyy")
If sheets("BD").Range("a2").Value >= DlgFind.StartDate.Value Or sheets("BD").Range("a2").Value <= DlgFind.StopDate.Value Then
Set d1 = sheets("BD").Range("A:A").Find(CDate(DlgFind.StartDate.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not d1 Is Nothing Then startRow = d1.row
Set d2 = sheets("BD").Range("A:A").Find(CDate(DlgFind.StopDate.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not d2 Is Nothing Then stopRow = d2.row
sheets("BD").Select
sheets("BD").Range(Cells(startRow, 1), Cells(stopRow, 8)).Copy _
Destination:=sheets("CONSULT").Range("A15")
sheets("CONSULT").Select
Unload DlgFind
UserForm3.Show
End
message:
MsgBox "Date non valide verifier les dates de votre saisie svp", vbInformation, ("Attention")
End If
End Sub
Merci de votre aide
voila avec votre aide j'ai pu corriger le code qui cherche entre deux dates et ca marcher bien mais seulement quand ma base de donnes c a dire sheets("BD") a commencer a prendre de l'ampleur en cumulant les enregistrements le code a encore une fois foiré je ne sais pas si c'est du a la taille ou autre chose voila le bout de code :
Private Sub CommandButton1_Click()
Dim startRow As Integer, stopRow As Integer, d1 As Range, d2 As Range
On Error GoTo message
If StartDate = "" Then MsgBox "Veuillez entrer Une Date Svp"
StartDate = Format(StartDate, "dd/mm/yyyy")
If StopDate = "" Then MsgBox "une date de fin Svp"
StopDate = Format(StopDate, "dd/mm/yyyy")
If sheets("BD").Range("a2").Value >= DlgFind.StartDate.Value Or sheets("BD").Range("a2").Value <= DlgFind.StopDate.Value Then
Set d1 = sheets("BD").Range("A:A").Find(CDate(DlgFind.StartDate.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not d1 Is Nothing Then startRow = d1.row
Set d2 = sheets("BD").Range("A:A").Find(CDate(DlgFind.StopDate.Value), LookIn:=xlValues, lookat:=xlWhole)
If Not d2 Is Nothing Then stopRow = d2.row
sheets("BD").Select
sheets("BD").Range(Cells(startRow, 1), Cells(stopRow, 8)).Copy _
Destination:=sheets("CONSULT").Range("A15")
sheets("CONSULT").Select
Unload DlgFind
UserForm3.Show
End
message:
MsgBox "Date non valide verifier les dates de votre saisie svp", vbInformation, ("Attention")
End If
End Sub
Merci de votre aide