Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default 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
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default 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
|
|




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default 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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work gpmichal Setting up and Configuration of Excel 1 May 12th 09 02:33 AM
Input Box Cancel Jase Excel Discussion (Misc queries) 2 September 15th 08 11:42 PM
Disabling 'Cancel' option when saving work (Yes/No/Cancel) [email protected] Excel Programming 0 July 11th 06 09:28 PM
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM
How do I check if a user clicked the Print Cancel button joanne Excel Programming 0 September 5th 03 08:24 AM


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"