Bonjour à tous les lecteurs,
J'aimerais me débarrasser de cette loop.
Mais comment le code en l'état actuel loope sans s'arrêter
Le but serait que lorsque l'on clic sur le MonthView dans la liste box il m'affiche toutes les entrées de la date en question.
Le code fonctionne comment afficher tout d'un coup sans passer par :
If MsgBox("Suivant", vbYesNo + vbInformation) = vbNo Then Exit Do
sans compter que si on répond jamais VbNo bien entendu ça continue ....
Merci par avance pour vos réponses
Card
-------------------------------------------------------------------
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
ListBox1.Clear
Application.Sheets("TeeOffTimes").Activate
[a2].Select
TXTDate.Text = MonthView1.Month & "/" & MonthView1.Day & "/" & MonthView1.Year
ListBox1.Clear
Dim findValue As String
Dim rngFind As Range
findValue = TXTDate.Text
Set rngFind = Range("A:J").Find(What:=findValue, After:=Range("B1"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If rngFind Is Nothing Then
' No Match
ListBox1.AddItem "RIEN"
Else
Do Until rngFind Is Nothing
ListBox1.AddItem rngFind & " " & rngFind.Offset(0, 1) & " " & rngFind.Offset(0, 2) & " " & rngFind.Offset(0, 3) & " " & rngFind.Offset(0, 4) & " " & rngFind.Offset(0, 5) & " " & rngFind.Offset(0, 6) & " " & rngFind.Offset(0, 7) & " " & rngFind.Offset(0, 8)
Set rngFind = Range("A:J").FindNext(rngFind)
If MsgBox("Suivant", vbYesNo + vbInformation) = vbNo Then Exit Do
Set rngFind = Range("A:J").FindNext(rngFind)
rngFind.Select
ActiveCell.EntireRow.Select
Loop
End If
End Sub
J'aimerais me débarrasser de cette loop.
Mais comment le code en l'état actuel loope sans s'arrêter
Le but serait que lorsque l'on clic sur le MonthView dans la liste box il m'affiche toutes les entrées de la date en question.
Le code fonctionne comment afficher tout d'un coup sans passer par :
If MsgBox("Suivant", vbYesNo + vbInformation) = vbNo Then Exit Do
sans compter que si on répond jamais VbNo bien entendu ça continue ....
Merci par avance pour vos réponses
Card
-------------------------------------------------------------------
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
ListBox1.Clear
Application.Sheets("TeeOffTimes").Activate
[a2].Select
TXTDate.Text = MonthView1.Month & "/" & MonthView1.Day & "/" & MonthView1.Year
ListBox1.Clear
Dim findValue As String
Dim rngFind As Range
findValue = TXTDate.Text
Set rngFind = Range("A:J").Find(What:=findValue, After:=Range("B1"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If rngFind Is Nothing Then
' No Match
ListBox1.AddItem "RIEN"
Else
Do Until rngFind Is Nothing
ListBox1.AddItem rngFind & " " & rngFind.Offset(0, 1) & " " & rngFind.Offset(0, 2) & " " & rngFind.Offset(0, 3) & " " & rngFind.Offset(0, 4) & " " & rngFind.Offset(0, 5) & " " & rngFind.Offset(0, 6) & " " & rngFind.Offset(0, 7) & " " & rngFind.Offset(0, 8)
Set rngFind = Range("A:J").FindNext(rngFind)
If MsgBox("Suivant", vbYesNo + vbInformation) = vbNo Then Exit Do
Set rngFind = Range("A:J").FindNext(rngFind)
rngFind.Select
ActiveCell.EntireRow.Select
Loop
End If
End Sub