PDA

View Full Version : Squential numbering in excal spreadsheets


stingrayiii
Jul 3, 2008, 04:16 PM
I'm using Excel 2003 and want to make some raffle tickets and have the numbers automatically put in each ticket. How do I do this?

Thanks, Steve (stingrayiii)

JBeaucaire
Jul 3, 2008, 04:30 PM
Are you going to print a single page per raffle ticket, or a bunch per page?

I helped a guy recently figure a way to have each print job change a serial number using a macro. The same macro would work for you, just need to know many raffle tickets will print each time you print the page. If one, the macro will work as-is. If you design say 8-tickets per page, we just have to adjust macro a little. Let me know.

JBeaucaire
Jul 3, 2008, 04:45 PM
ONE TICKET AT A TIME
If it's one ticket per page, pick a cell and put the raffle ticket number in it. Let's pretend it's A1.

TOOLS > MACRO > MACROS

Enter a new macro title PRINTRAFFLE1, then click CREATE

The macro window will appear, paste in this code, make sure it looks exactly like this when you're done:



Sub PRINTRAFFLE1()
a = Application.InputBox("Enter No of Raffle Tickets to print:", , , , , , , 1)
If a <= 1 Then
MsgBox "Must be more than 1"
Exit Sub
End If
For n = 1 To a
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Value = Range("A1").Value + 1
Next n
End Sub
Now to print your raffle tickets, click on TOOLS > MACRO > MACROS

Select PRINTRAFFLE1 > RUN

Running this macro ASKS you how many serial numbers you need. Then it prints the sheet, increasing the serial number by 1 each time.
================
EIGHT TICKETS AT A TIME

Same idea as above except you have 8 tickets on one page.

In the cell A1 put your starting serial number. Then in the same "position" on ticket #2, you use the formula =A1+1

Continue that process for the other 6 tickets, ticket #3 will use the formula =A1+2, etc. Make sure you have Eight unique numbers on the page with only one real number in cell A1.

Now, create the macro as shown above except the code this time is:


Sub PRINTRAFFLE8()
a = Application.InputBox("Enter number of Raffle Ticket SHEETS to print :", , , , , , , 1)
If a <= 1 Then
MsgBox "Must be more than 1"
Exit Sub
End If
For n = 1 To a
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Value = Range("A1").Value + 8
Next n
End Sub
Now, when you run the macro PRINTRAFFLE8 it will ask you how many pages, then print out that many incrementing the numbers by 8 each time.
==========

NOTE: More than likely your key serial number WON'T be in cell A1. Just edit the macro(s) and put in the cell reference in both places you see A1 in there now. There are two of them, so change them both.

If you use some number of tickets other than 8, just look at the macro and change the number 8 to the number you're printing... 6 or 10 or whatever.

Good luck!