![]() |
Handling the 'Cancel' button..??
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 |
Handling the 'Cancel' button..??
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 |
All times are GMT +1. The time now is 12:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com