Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code:
Do Msg = "Is the BILLING DATE below correct?" & Chr(10) & Chr(10) _ & "If not, Enter correct date ..." Default = Worksheets("Sheet2").Range("N2") BillDate = InputBox(Msg, Title, Default) ' get billing date Worksheets("Sheet2").Range("N2") = BillDate 'Put BillDate into Sheet2 N2 If BillDate < "" Then Exit Do MsgBox "Please enter Billing Date", 48, Title Loop It works like a champ but... How would I handle someone hitting the 'Cancel button? At this point if 'Cancel' is pressed I get the "Please enter billing date" msg and it loops around again. Thanks for the help. RJH |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi RJH,
Try: Do Msg = "Is the BILLING DATE below correct?" _ & Chr(10) & Chr(10) _ & "If not, Enter correct date ..." myDefault = Worksheets("Sheet2").Range("N2") BillDate = InputBox(Msg, Title, myDefault) Worksheets("Sheet2").Range("N2") = BillDate If StrPtr(BillDate) = 0 Then MsgBox "You cancelled" Exit Do End If If BillDate < "" Then Exit Do MsgBox "Please enter Billing Date", 48, Title Loop Note that I changed your Default variable to myDefault as the former is a keyword and it use may cause problems. --- Regards, Norman "RJH" wrote in message ... I have the following code: Do Msg = "Is the BILLING DATE below correct?" & Chr(10) & Chr(10) _ & "If not, Enter correct date ..." Default = Worksheets("Sheet2").Range("N2") BillDate = InputBox(Msg, Title, Default) ' get billing date Worksheets("Sheet2").Range("N2") = BillDate 'Put BillDate into Sheet2 N2 If BillDate < "" Then Exit Do MsgBox "Please enter Billing Date", 48, Title Loop It works like a champ but... How would I handle someone hitting the 'Cancel button? At this point if 'Cancel' is pressed I get the "Please enter billing date" msg and it loops around again. Thanks for the help. RJH |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vb cancel button | Excel Programming | |||
Cancel button to cancel the whole macro | Excel Programming | |||
Cancel button | Excel Programming | |||
Cancel Button | Excel Programming | |||
input box cancel button | Excel Programming |