Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Function TodayTip() As String Dim nSheetIndex As Long Dim sEvent As String Dim nRowIndex As Long nSheetIndex = Month(Date) + 5 If nSheetIndex > 13 Then nSheetIndex = nSheetIndex - 12 End If With Worksheets(nSheetIndex) For nRowIndex = 4 To 4 + Day(Date) If LenB(.Cells(nRowIndex, 6)) Then If LenB(.Cells(nRowIndex, 7)) Then sEvent = .Cells(nRowIndex, 7) End If Else sEvent = vbNullString End If Next If LenB(sEvent) = 0 Then For nRowIndex = 4 + Day(Date) To 34 If LenB(.Cells(nRowIndex, 7)) Then sEvent = FormatDateTime(DateSerial(Year(Date), Month(Date), .Cells(nRowIndex, 5)), vbLongDate) & " - " & .Cells(nRowIndex, 7) Exit For End If Next End If TodayTip = sEvent End With End Function
Public Function TodayTip(Byval vdIn As Date) As String Dim nSheetIndex As Long Dim sEvent As String Dim nRowIndex As Long nSheetIndex = Month(vdIn) + 5 If nSheetIndex > 13 Then nSheetIndex = nSheetIndex - 12 End If With Worksheets(nSheetIndex) For nRowIndex = 4 To 4 + Day(vdIn) If LenB(.Cells(nRowIndex, 6)) Then If LenB(.Cells(nRowIndex, 7)) Then sEvent = .Cells(nRowIndex, 7) End If Else sEvent = vbNullString End If Next If LenB(sEvent) = 0 Then For nRowIndex = 4 + Day(vdIn) To 34 If LenB(.Cells(nRowIndex, 7)) Then sEvent = FormatDateTime(DateSerial(Year(vdIn), Month(vdIn), .Cells(nRowIndex, 5)), vbLongDate) & " - " & .Cells(nRowIndex, 7) Exit For End If Next End If TodayTip = sEvent End With End Function
If LenB(sEvent) = 0 Then For nRowIndex = 4 + Day(vdIn) To 34 If LenB(.Cells(nRowIndex, 7)) Then sEvent = FormatDateTime(DateSerial(Year(vdIn), Month(vdIn), .Cells(nRowIndex, 5)), vbLongDate) & " - " & .Cells(nRowIndex, 7) Exit For End If Next End If
If LenB(sEvent) = 0 Then sEvent = TodayTip(DateSerial(Year(vdIn), Month(vdIn)+1,1)) End If
If nSheetIndex > 13 Then
nSheetIndex = nSheetIndex - 12
End If
x = month(date) nSheetIndex IIf(x 7, 12, (x + 5) Mod 12)