Hallo,
ich möchte per Makro das Geburtsdatum errechen, und habe dazu im
Internet folgenden Code gefunden:
ms-excel.eu/vba/excel-vba-datum/vba-geburtstage-anzeigen.html
Option Explicit
Sub Geburtstag()
Dim intgeb As Integer
Dim Loletzte As Long
Dim MsgText As String
Dim intalter As Integer
Loletzte = IIf(IsEmpty(Range("c65536")), Range("c65536").End(xlUp).Row, 65536)
For intgeb = 2 To Loletzte
intalter = (DateSerial(Year(Date), Month(Date), Day(Date)) - DateSerial(Year(Cells(intgeb, 3)), Month(Cells(intgeb, 3)), _
Day(Cells(intgeb, 3)))) / 365.25
If DateSerial(Year(Date), Month(Cells(intgeb, 3)), Day(Cells(intgeb, 3))) >= DateSerial(Year(Date), Month(Date), _
Day(Date)) And DateSerial(Year(Date), Month(Cells(intgeb, 3)), Day(Cells(intgeb, 3))) <= DateSerial(Year(Date), _
Month(Date), Day(Date) + 14) Or DateSerial(Year(Date) + 1, Month(Cells(intgeb, 3)), Day(Cells(intgeb, 3))) _
<= DateSerial(Year(Date), Month(Date), Day(Date) + 14) Then
MsgText = MsgText & vbLf & vbLf & Cells(intgeb, 3 - 2) & ", " & Cells(intgeb, 3 - 1) & " " & Cells(intgeb, 3) _
& " " & "wird " & intalter & " Jahre alt"
End If
Next intgeb
If Len(MsgText) > 0 Then MsgBox Right(MsgText, Len(MsgText) - 2)
End Sub
Bei mir befindet sich das Geburtsdatum in Spalte D, und wenn ich obigen Code ändere, so muss dieser wohl auch in den unteren Bereichen geänder werden, oder ?
Ich habe leider keinen Plan von Excel Makros, und würde daher gerne wissen welche Bereiche ich anpassen muss.
Kann mir jemand auf die Sprünge helfen ???
Vielen Dank schonmal.