Public Function RowFromDate(ByVal vdInput As Date, Optional ByVal vnOffset As Integer = 2) As Integer RowFromDate = vnOffset + vdInput - DateSerial(Year(vdInput), 1, 1) End Function Public Function RangeFromDates(ByVal vdStart As Date, ByVal vdEnd As Date, ByVal vnColumn As Integer) As Range Set RangeFromDates = Range(Cells(RowFromDate(vdStart), vnColumn), Cells(RowFromDate(vdEnd), vnColumn)) End Function Sub test() RangeFromDates(#1/19/2009#, #2/11/2009#, 5) = "CP" End Sub
Public Function RowFromDate(ByVal vdInput As Date, Optional ByVal vnOffset As Integer = 4) As Integer RowFromDate = vnOffset + vdInput - Range("A2").Value End Function Private Sub CP1_Change() Range("CPRTT!B14").Value = Format(CP1.Value, "mm/dd/yyyy") If IsDate(CP2.Value) Then RangeFromDates(CP1.Value, CP2.Value, 12) = "CP" RangeFromDates(CP1.Value, CP2.Value, 13) = "CP" End If End Sub Private Sub CP2_Change() Range("CPRTT!B16").Value = Format(CP2.Value, "mm/dd/yyyy") On Local Error Resume Next Me.CP3.Value = Range("CPRTT!B18").Value RangeFromDates(CP1.Value, CP2.Value, 12) = "CP" RangeFromDates(CP1.Value, CP2.Value, 13) = "CP" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionmais je n'arrive pas à le mettre en place