ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   first go around inputbox (https://www.excelbanter.com/excel-programming/393844-first-go-around-inputbox.html)

Curt

first go around inputbox
 
Found out when testing I didn't get all needed. What I've got works unless
you hit cancel or enter 0 Following is what I've done seems all I find goes
to a greater extent than I need. All help greatly appreciated.
Following is what iI've got
Thanks to All

With Sheets("Check_In")
Sheets("Check_In").Select
pCnt = InputBox("How Many Copies") '2
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(pCnt), Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
End With



JLatham

first go around inputbox
 
Try modifying your code to add this stuff (I'm showing complete routine but
it doesn't include your With/End With and .Select and Printout statements,
which you need to add back in).

Sub TestInputBox()
Dim pCnt As Integer

On Error Resume Next
pCnt = InputBox("Enter # of copies", , 0)
If Err < 0 Then
'they hit [Cancel]
Err.Clear
On Error GoTo 0
Exit Sub
End If
On Error GoTo 0
'didn't hit [Cancel] but pCnt may be zero
If pCnt 0 Then
'do your printout command here
End If

End Sub

"Curt" wrote:

Found out when testing I didn't get all needed. What I've got works unless
you hit cancel or enter 0 Following is what I've done seems all I find goes
to a greater extent than I need. All help greatly appreciated.
Following is what iI've got
Thanks to All

With Sheets("Check_In")
Sheets("Check_In").Select
pCnt = InputBox("How Many Copies") '2
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(pCnt), Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
End With



Bob Phillips

first go around inputbox
 
pCnt = InputBox("How Many Copies") '2
If pCnt < "" Then

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Curt" wrote in message
...
Found out when testing I didn't get all needed. What I've got works unless
you hit cancel or enter 0 Following is what I've done seems all I find
goes
to a greater extent than I need. All help greatly appreciated.
Following is what iI've got
Thanks to All

With Sheets("Check_In")
Sheets("Check_In").Select
pCnt = InputBox("How Many Copies") '2
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(pCnt), Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count,
"B").End(xlUp).Row
End With





Jim Cone

first go around inputbox
 

pCnt = Val(InputBox("How Many Copies"))
If pCnt < 1 or pCnt 9 Then Exit Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Curt"
wrote in message
Found out when testing I didn't get all needed. What I've got works unless
you hit cancel or enter 0 Following is what I've done seems all I find goes
to a greater extent than I need. All help greatly appreciated.
Following is what iI've got
Thanks to All

With Sheets("Check_In")
Sheets("Check_In").Select
pCnt = InputBox("How Many Copies") '2
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(pCnt), Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
End With



Jim Thomlinson

first go around inputbox
 
For that I like an Application.InputBox with Type set to 1 to validate for
numbers. Something like this...

dim pCnt as Long
pCnt = Appliation.InputBox("How Many Copies", Type:=1)
If pCnt < 1 or pCnt 9 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:


pCnt = Val(InputBox("How Many Copies"))
If pCnt < 1 or pCnt 9 Then Exit Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Curt"
wrote in message
Found out when testing I didn't get all needed. What I've got works unless
you hit cancel or enter 0 Following is what I've done seems all I find goes
to a greater extent than I need. All help greatly appreciated.
Following is what iI've got
Thanks to All

With Sheets("Check_In")
Sheets("Check_In").Select
pCnt = InputBox("How Many Copies") '2
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(pCnt), Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
End With




Curt

first go around inputbox
 
Thanks much Jim Your explanation makes it east to grap
Thanks Again

"Jim Thomlinson" wrote:

For that I like an Application.InputBox with Type set to 1 to validate for
numbers. Something like this...

dim pCnt as Long
pCnt = Appliation.InputBox("How Many Copies", Type:=1)
If pCnt < 1 or pCnt 9 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
--
HTH...

Jim Thomlinson


"Jim Cone" wrote:


pCnt = Val(InputBox("How Many Copies"))
If pCnt < 1 or pCnt 9 Then Exit Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Curt"
wrote in message
Found out when testing I didn't get all needed. What I've got works unless
you hit cancel or enter 0 Following is what I've done seems all I find goes
to a greater extent than I need. All help greatly appreciated.
Following is what iI've got
Thanks to All

With Sheets("Check_In")
Sheets("Check_In").Select
pCnt = InputBox("How Many Copies") '2
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(pCnt), Collate:=True '2
.pagesetup.PrintArea = "A2:D" & Cells(Rows.Count, "B").End(xlUp).Row
End With





All times are GMT +1. The time now is 01:21 PM.

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