Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1800to1804
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Messagebox nur wenn Geburtstag

Messagebox nur wenn Geburtstag
31.12.2020 12:35:16
Roland
Mahlzeit !
Ich habe folgenden Code in einem Forum (Eintrag schon mehr als 3 Jahre her) gefunden.
Der ua. Code funktioniert auch wunderbar.
Ich habe nur eine Frage.
Die Messagebox wird auch angezeigt, wenn kein Geburtstag anfällt. Kann mir da bitte jemand behilflich sein, wie ich den Code im Modul umändern muss, damit die Messagebox nur dann erscheint, wenn auch tatsächlich jemand Geburtstag hat?
Dieser Code steht in "diese Arbeitsmappe"
Call RPP
End Sub
Dieser Code steht in einem Modul
Option Explicit
Dim Birthday As String
Sub RPP()
Birthday = "Aktuelle Geburtstage:" & vbLf & String(80, "-") & vbLf
Ausgabe Format(Date, "dd. mmmm")
MsgBox Birthday, , "Geburtstagsmeldung"
Birthday = vbNullString
End Sub

Sub Ausgabe(Heute As String)
Dim Fund As Range, firstAddress As String
Set Fund = Tabelle1.Columns(61).Find(Heute, , xlValues, xlWhole)
If Not Fund Is Nothing Then
firstAddress = Fund.Address
Do
Birthday = Birthday & _
Fund.Offset(0, -2) & vbLf
Set Fund = Tabelle1.Columns(61).FindNext(Fund)
Loop While Not Fund Is Nothing And Fund.Address  firstAddress
End If
Set Fund = Nothing
End Sub

16
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:04:44
onur

Sub RPP()
Ausgabe Format(Date, "dd. mmmm")
If Not Birthday="" Then MsgBox Birthday, , "Geburtstagsmeldung"
Birthday = ""
End Sub
Sub Ausgabe(Heute As String)
Dim Fund As Range, firstAddress As String
Birthday = "Aktuelle Geburtstage:" & vbLf & String(80, "-") & vbLf
Set Fund = Tabelle1.Columns(61).Find(Heute, , xlValues, xlWhole)
If Not Fund Is Nothing Then
if Birthday="" then
Birthday = "Aktuelle Geburtstage:" & vbLf & String(80, "-") & vbLf
end if
firstAddress = Fund.Address
Do
Birthday = Birthday & _
Fund.Offset(0, -2) & vbLf
Set Fund = Tabelle1.Columns(61).FindNext(Fund)
Loop While Not Fund Is Nothing And Fund.Address  firstAddress
End If
Set Fund = Nothing
End Sub

Anzeige
@onur Birthday hat aber immer einen Wert owt
31.12.2020 13:09:57
ralf_b
AW: @onur Birthday hat aber immer einen Wert owt
31.12.2020 13:10:57
onur
WIESO?
AW: @onur Birthday hat aber immer einen Wert owt
31.12.2020 13:14:05
ralf_b
in Ausgabe wird birthday vorbelegt.
Birthday = "Aktuelle Geburtstage:" & vbLf & String(80, "-") & vbLf
AW: @onur Birthday hat aber immer einen Wert owt
31.12.2020 13:16:02
onur
Wurde in der ersten Version schon vor Ausgabe vorbelegt.
AW: @onur Birthday hat aber immer einen Wert owt
31.12.2020 13:16:47
onur
Wurde in der ersten Version schon vor Ausgabe vorbelegt.
AW: @onur Birthday hat aber immer einen Wert owt
31.12.2020 13:17:36
onur
Wird nur vorbelegt, wenn zum ersten Mal was gefunden wird.
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:19:20
GerdL
Moin,
teste mal
Option Explicit
Dim Birthday As String
Sub RPP()
Birthday = "Aktuelle Geburtstage:" & vbLf & String(80, "-") & vbLf
Ausgabe Format(Date, "dd. mmmm")
If Len(Birthday) > 0 Then MsgBox Birthday, , "Geburtstagsmeldung"
Birthday = vbNullString
End Sub
Sub Ausgabe(Heute As String)
Dim Fund As Range, firstAddress As String
Set Fund = Tabelle1.Columns(61).Find(Heute, , xlValues, xlWhole)
If Not Fund Is Nothing Then
firstAddress = Fund.Address
Do
Birthday = Birthday & _
Fund.Offset(0, -2) & vbLf
Set Fund = Tabelle1.Columns(61).FindNext(Fund)
Loop While Not Fund Is Nothing And Fund.Address  firstAddress
Else
Birthday = ""
End If
Set Fund = Nothing
End Sub
Gruß Gerd
Anzeige
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:23:21
onur

Birthday = "Aktuelle Geburtstage:" & vbLf & String(80, "-") & vbLf
Ausgabe Format(Date, "dd. mmmm")
If Len(Birthday) > 0 Then MsgBox Birthday, , "Geburtstagsmeldung"

In der 3. Zeile ist Birthday schon dank
Birthday ="Aktuelle Geburtstage: usw usw"

gesetzt, also wird die MsgBox auf jeden Fall erscheinen.
AW: Falsch! Teste mal mit ganzem Code!
31.12.2020 13:35:01
GerdL
.
AW: Falsch! Teste mal mit ganzem Code!
31.12.2020 13:41:31
onur
Habe dir doch dazu schon was gepostet!
AW: Falsch! Teste mal mit ganzem Code!
31.12.2020 13:43:26
onur
Und zwar um 13:30:31 Uhr
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:27:53
Roland
Super Danke. Der Code von GerdL funkt bestens.
Danke und guten Rutsch
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:32:58
onur
Wenn dir DREI LEUTE helfen wollen und ihre Freizeit dafür opfern,, solltest du dich auch bei ALLEN bedanken und nicht nur bei dem DRITTEN.
Anzeige
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:30:31
onur
Sorry GerdL, habe übersehen, dass du in Ausgabe schon Birthday="" setzt, wenn nix gefunden wurde.
AW: Messagebox nur wenn Geburtstag
31.12.2020 13:48:02
Roland
Ich wollte auf keinen Fall unhöflich sein und möchte mich hier nochmals bei allen, die mir geholfen haben, BEDANKEN.
Allen hier einen guten Rutsch ins neue Jahr.

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige