|
|
 |
|
 |
|
 |
 |
|
Hilfe zum Thema: Excel, Software
Re: Datumsrechnung bei Krankenschein
Hallo Frank, dein Von-Datum steht in A1, dein Bis-Datum in B1, dann in C1: =AnzahlTage(A1;B1) Die Function in ein allgemeines Modul kopieren.
Option Explicit Public Function AnzahlTage(DatVon As Date, DatBis As Date) As String Dim dDatum As Date Dim iMonat As Integer Dim aTage() As Variant Dim iIndex As Integer dDatum = DatVon iMonat = Month(dDatum) iIndex = 1 ReDim aTage(iIndex) aTage(iIndex) = 1 Do dDatum = dDatum + 1 If Month(dDatum) <> iMonat Then iIndex = iIndex + 1 ReDim Preserve aTage(iIndex) aTage(iIndex) = 1 iMonat = Month(dDatum) Else aTage(iIndex) = aTage(iIndex) + 1 End If Loop Until dDatum = DatBis iMonat = Month(DatVon) For iIndex = 1 To UBound(aTage) If AnzahlTage = "" Then AnzahlTage = "Monat " & iMonat & " " & aTage(iIndex) Else iMonat = iMonat + 1 AnzahlTage = AnzahlTage & ", " & "Monat " & iMonat & " " & aTage(iIndex) End If Next iIndex End Function
Code eingefügt mit Syntaxhighlighter 4.4
Gruß Peter
|
Google-Anzeigen
|
|
 |
Geschickt von pefeu, Mi 30.04.2008 15:06
|
 |
 |
|