ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input box to cancel sub when Cancel is clicked. (https://www.excelbanter.com/excel-programming/372117-input-box-cancel-sub-when-cancel-clicked.html)

PCLIVE

Input box to cancel sub when Cancel is clicked.
 
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 Patrick

Input box to cancel sub when Cancel is clicked.
 
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
|
|



PCLIVE

Input box to cancel sub when Cancel is clicked.
 
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 Patrick

Input box to cancel sub when Cancel is clicked.
 
Ok, but that's a different question. What rules or criteria is going to make
the Input box default change?

--

Regards,

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

"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 Peterson

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

PCLIVE

Input box to cancel sub when Cancel is clicked.
 
Dave,

This does what I need. Your help is much appreciated.

Thank you,
Paul

"Dave Peterson" wrote in message
...
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





All times are GMT +1. The time now is 12:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com