View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Input box to cancel sub when Cancel is clicked.

Option Explicit
Public Sub test()
Dim Resp As String

Resp = InputBox("Enter Next Invoice Month", "Creat Invoice.", _
Range("M16").Value)
If Resp = "" Then
Exit Sub
Else
Range("o1").Value = Resp
End If
End Sub

PCLIVE wrote:

Thanks for the response.

This kind of works, but I still need to somehow use the input box entry in
the "Else" code. For example, I'd like to make Range("O1").value to be the
inputbox entry.

Thanks again.

"Dave Patrick" wrote in message
...
Public Sub test()
If InputBox("Enter Next Invoice Month", "Creat Invoice.",
Range("M16").Value) = "" Then
Exit Sub
Else
'do some stuff here
End If
End Sub

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"PCLIVE" wrote:
| Can I write an "InputBox" statement to end the sub if the Cancel button
is
| clicked? This is the line that I have.
|
| InputBox "Enter Next Invoice Month", "Creat Invoice.",
Range("M16").Value
|
|
| Thanks,
| Paul
|
|



--

Dave Peterson