LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default InputBox / VBA question ok = print, cancel = exit

Here is my code. Keep in mind I am by no means an experienced Visual Basic or
VBA programmer:

Dim Response As String
Sub printinvoice()
'
' printinvoice Macro
' Macro recorded 8/7/2007 by tcobane
'
' Keyboard Shortcut: Ctrl+Shift+V
'
Sheets("C").Select
Response = Application.InputBox(prompt:="Enter Invoice Number", Type:=2,
Default:="", Title:="Print Invoice")
If Trim(Response) = "" Or Empty Then
Range("H14") = " "
Exit Sub
Else
Range("H14") = Response
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("A").Select
End If
End Sub
--------------------------------------------------------------------------------

What I'm trying to do is make it so the user inputs a number into the input
box, the number is transferred to Cell H14 on sheet C and then sheet C is
printed. If the user hits "cancel" then nothing is printed and the user is
returned to sheet A.

As it sits now, hitting cancel will still print sheet C with a "0" in cell
H14.

Any tips are appreciated. Someone borrowed my VB textbook from college so I
have no other resources at the moment.


 
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
Another InputBox question... Phil Excel Discussion (Misc queries) 4 April 12th 07 03:37 PM
Private Textbox Exit Sub question... [email protected] Excel Worksheet Functions 14 March 1st 07 03:58 AM
after i send a file to print, how do i cancel it andrew a Excel Discussion (Misc queries) 3 February 24th 07 06:46 PM
Detecting Cancel in an InputBox Method Connie Excel Discussion (Misc queries) 2 October 19th 06 01:32 PM
inputbox question redb Excel Discussion (Misc queries) 0 October 6th 05 02:57 PM


All times are GMT +1. The time now is 08:21 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"