Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Input box cancel

strjobnumber = InputBox("Start in Job Number?", " First Job to Print", 0)
If strjobnumber < "" Then
'do stuff
End If


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Little Penny" wrote in message
...
How do I get the code to exit if someone hit cancel on the input box



strjobnumber = InputBox("Start in Job Number?", " First Job to Print",
0)
endjobnumber = InputBox("Finish in Job Number?", " Last Job to
Print", 0)




Sub doprint()
'
' doprint Macro


Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = InputBox("Start in Job Number?", " First Job to
Print", 0)
endjobnumber = InputBox("Finish in Job Number?", " Last Job to
Print", 0)

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value

If c < 100 Then GoTo NextCounter

Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
NextCounter:
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub



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
Input Box Cancel Jase Excel Discussion (Misc queries) 2 September 15th 08 11:42 PM
Input Box - CANCEL Danny Excel Worksheet Functions 6 December 1st 06 02:15 AM
cancel input ME @ Home Excel Discussion (Misc queries) 1 February 22nd 06 09:49 AM
Input Box Cancel Event Craig[_20_] Excel Programming 3 September 7th 04 10:21 AM
Input Box Cancel Button rickylee Excel Programming 2 January 6th 04 11:43 PM


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