LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default numbers (like invoice numbers) in Excel worksheet

this
EndNum = Application.InputBox("Enter number of copies to print:", Type:=1)

should have been this

EndNum = Application.InputBox("Enter Ending number:", Type:=1)


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
give this a try. change the rng, the worksheet name and the cell the
number is in. watch for word wrap when you paste the code
i also have to set to preview instead of print.


Option Explicit
Sub print_invoices()
Dim EndNum As Long, StartNum As Long
Dim ws As Worksheet
Dim i As Long
Dim rng As Range
Dim bOK As Boolean

Set ws = Worksheets("Sheet1")
Set rng = ws.Range("A1:E40")

StartNum = Application.InputBox("Enter Starting Number:", Type:=1)
EndNum = Application.InputBox("Enter number of copies to print:",
Type:=1)
If StartNum = 0 Then GoTo Xit
If EndNum = 0 Then GoTo Xit
bOK = Application.Dialogs(xlDialogPrinterSetup).Show 'choose the
printer
If bOK = False Then GoTo Xit
Application.ScreenUpdating = False

For i = StartNum To EndNum
ws.Range("A1").Value = i
With ws.PageSetup
.HeaderMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.4)
.LeftMargin = Application.InchesToPoints(0.4)
.TopMargin = Application.InchesToPoints(1.5)
.BottomMargin = Application.InchesToPoints(0.5)
.PrintArea = rng.Address
.CenterHorizontally = True
.CenterVertically = False
.Zoom = 100

End With
With ws
.PrintPreview
' .PrintOut Copies:=1, Collate:=True
End With

Next
Xit:
Application.ScreenUpdating = True
End Sub


--


Gary


"Max Bialystock" wrote in message
...
I want to print out 70 copies of an order form. Each form needs to be
numbered. The first form to be printed will numbered "1". The last form to
be printed will be numbered "70".

If, in future, I need to print more of these forms, then next one I print
out should be numbered "71".

How do I do this, please?








 
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
How to gernerate invoice numbers in EXCEL? Ed Excel Discussion (Misc queries) 2 April 16th 10 02:50 AM
how can i set up changing invoice numbers in excel? aninya Excel Worksheet Functions 1 March 4th 09 06:43 PM
Negative numbers in Excel Invoice Karen Excel Discussion (Misc queries) 4 August 4th 08 11:12 PM
Excel - invoice numbers Nicol Excel Worksheet Functions 1 May 22nd 07 10:46 AM
increment invoice numbers in excel Allan Excel Discussion (Misc queries) 9 July 13th 05 01:44 PM


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