Hallo Forum!
Ich bin gerade dabei eine automatisierte Geburtstagliste mit VBA zu fertigen!
Ich bin auch schon recht weit gekommen, obwohl ich davon eigentlich keine Ahnung habe :-)!
Aber hier nun mein Problem:
Das Programm ist momentan so gestrickt, dass es mir nur Geburtstage meldet, die auf den Tag fallen!
Ich hätte das jetzt auch gerne so, dass es mir Geburtstage meldet, die z. B. vor einer Woche oder vor zwei Tagen waren oder die, die z. B. in einer Woche oder zwei Tagen sind! (ich hoffe, dass ist soweit verständlich?!)
Hier mein bisheriger Code:
Sub Workbook_open()
Application.DisplayFullScreen = True
Application.CommandBars("Worksheet Menu Bar").Enabled = False
Worksheets("Geburtstag").Activate
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
ActiveWindow.DisplayWorkbookTabs = False
Application.ScreenUpdating = True
c = 0
a = Day(Date)
b = Month(Date)
If Cells(5, 1) = "" Then
Info = MsgBox("Heute hat keiner Geburtstag", vbInformation, "Kein Geburtstag!")
Exit Sub
End If
For zeile = 5 To Range("c65536").End(xlUp).Row
If Day(Cells(zeile, 3)) = a And Month(Cells(zeile, 3)) = b Then
Achtung.L_Name.Caption = Cells(zeile, 2) & " " & Cells(zeile, 1)
Achtung.L_Alter.Caption = Cells(zeile, 5)
Achtung.L_Tage.Caption = Cells(zeile, 6)
Achtung.Show
c = c + 1
End If
Next zeile
For zeile = 5 To Range("c65536").End(xlUp).Row
If Day(Cells(zeile, 3)) = a And Month(Cells(zeile, 3)) = b Then
Achtung.L_Name.Caption = Cells(zeile, 2) & " " & Cells(zeile, 1)
Achtung.L_Alter.Caption = Cells(zeile, 5)
Achtung.L_Tage.Caption = Cells(zeile, 6)
Achtung.Show
c = c + 1
End If
Next zeile
If c = 0 Then Info = MsgBox("Heute hat keiner Geburtstag", vbInformation, "Kein Geburtstag!")
End Sub |