Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Printing / March 2005

Tip: Looking for answers? Try searching our database.

Incrementing Cell Numbers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lance W. Grimes - 08 Mar 2005 19:28 GMT
All:

I have created an excel "Workorder" form for our employees to write in what
machine they are working on, what parts they used, and how long they spent
on the repair...

The problem...  I need to print out hundreds of these forms for the men to
use, and each copy of the form needs to have an unique number.

Is there a way to program a cell to automatically increment by 1 every time
it is printed?   Again, I need to print hundres at a time, and I need them
to automatically increment by 1.

TIA,
Lance
Dave Peterson - 08 Mar 2005 21:48 GMT
Set up your worksheet the way you want (print layout).  Then use a macro to
print it.

Option Explicit
Sub testme()

   Dim myCell As Range
   Dim iCtr As Long
   Dim HowMany As Long
   
   HowMany = 5
   
   With Worksheets("sheet1")
       Set myCell = .Range("a1")
       
       If IsNumeric(myCell.Value) Then
           'keep going
       Else
           MsgBox "Please put a nice starting number in A1!"
           Exit Sub
       End If
       
       For iCtr = 1 To HowMany
           myCell.Value = myCell.Value + 1
           .PrintOut preview:=True
       Next iCtr
   End With
 
End Sub

I used 5 and "preview:=true" to save some trees.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

> All:
>
[quoted text clipped - 11 lines]
> TIA,
> Lance

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.