Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionFor 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
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 If LenB(.Cells(4 + Day(vdIn), 6)) Then sEvent = TodayTip(DateSerial(Year(vdIn), Month(vdIn),0)) Else 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 End If If LenB(sEvent) = 0 Then sEvent = TodayTip(DateSerial(Year(vdIn), Month(vdIn)+1,1)) 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 3 + 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 If LenB(.Cells(4 + Day(vdIn), 6)) Then sEvent = TodayTip(DateSerial(Year(vdIn), Month(vdIn), 0)) Else 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 End If If LenB(sEvent) = 0 Then sEvent = TodayTip(DateSerial(Year(vdIn), Month(vdIn) + 1, 1)) End If TodayTip = sEvent End With End Function
? Cells(39,12).FormulaLocal, Cells(39,12).Value
=todaytip(MAINTENANT()) du 18.12.09 au 03.01.10: Trève de Noël / il n'y aura pas cours !
? Cells(40,12).FormulaLocal, Cells(40,12).Value
=todaytip("1/1/2010") du 18.12.09 au 03.01.10: Trève de Noël / il n'y aura pas cours !
? Cells(42,12).FormulaLocal, Cells(42,12).Value
=todaytip("3/1/2010") Soirée interne de la nouvelle année
? Cells(43,12).FormulaLocal, Cells(43,12).Value
=todaytip("4/1/2010") Reprise des cours
? Cells(44,12).FormulaLocal, Cells(44,12).Value
=todaytip("5/1/2010") samedi 13 février 2010 - Stage à Carqueiranne: il n'y aura pas de cours durant cette période
? Cells(41,12).FormulaLocal, Cells(41,12).Value
=todaytip("2/1/2010") Soirée interne de la nouvelle année