LxGwy
New Member
- Joined
- Oct 31, 2012
- Messages
- 6
Intent: Display the Message Only once AND only for John Doe
When counter and username are used separately, works fine, but not for both
==========================================================
Option Explicit
Sub Macro5()
Dim MsgCounterJul05 As Long
'a zero will be placed in e5 (aka MsgCounterJul05)
Range("MsgCounterJul05") = Range("MsgCounterJul05") + 1
If Range("MsgCounterJul05").Value <= 1 Then GoTo msgForJD:
Else: GoTo MsgOverCount:
End If
msgForJD:
If Application.UserName = "John Doe" Then
MsgBox "If John Doe is the User, display this message", vbInformation, "One Time Message"
Else
MsgBox "This Message is for the NOT JDs only"
End If
MsgOverCount:
Exit Sub
End Sub
When counter and username are used separately, works fine, but not for both
==========================================================
Option Explicit
Sub Macro5()
Dim MsgCounterJul05 As Long
'a zero will be placed in e5 (aka MsgCounterJul05)
Range("MsgCounterJul05") = Range("MsgCounterJul05") + 1
If Range("MsgCounterJul05").Value <= 1 Then GoTo msgForJD:
Else: GoTo MsgOverCount:
End If
msgForJD:
If Application.UserName = "John Doe" Then
MsgBox "If John Doe is the User, display this message", vbInformation, "One Time Message"
Else
MsgBox "This Message is for the NOT JDs only"
End If
MsgOverCount:
Exit Sub
End Sub
Last edited: