View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
ozgrid.com ozgrid.com is offline
external usenet poster
 
Posts: 464
Default Help with InputBox and MsgBox

Sub NewStartDate()
Dim Prompt As String, Title As String
Dim StartDate As String

Prompt = "What's the new pay period start date?"
Title = "Start Date"
StartDate = InputBox(Prompt, Title)

If StartDate = vbNullString Then Exit Sub

If Not IsDate(StartDate) Then
MsgBox "Date is not valid"
Run "NewStartDate"
End If
End Sub



--
Regards
Dave Hawley
www.ozgrid.com



"Preschool Mike" wrote in message
...
How do I fix the below code so if a user does not enter anything in the
input
box or clicks on the cancel button they get what I have in the MsgBox?

MsgBox ("You did not enter a new pay period start date" & vbCrLf & _
"click on the 'EnterNewPayPeriod' button and re-enter the new pay period")

Sub NewStartDate()
Dim Prompt, Title As String
Prompt = "What's the new pay period start date?"
Title = "Start Date"
StartDate = InputBox(Prompt, Title)

End Sub
--
Mike Mast
Special Education Preschool Teacher