Number Incrimants..?

  • Thread starter Thread starter Jorge
  • Start date Start date
J

Jorge

Hello all.

I have developed a form in excel.
One of the cells contains a number field that I would like to automatically
increment each time it is printed.

i.e...
I type in the name field "Sprayberry BBQ" and in the number field I type "1"
I then decide to print 500 copies. I like the number field to place 2, 3,
4, 5 etc in the 500 copies.
Even if I have to place 1-500 in order to tell the program I want those
numbers...

Can this be accomplished? I've tried several things and I cannot get it to
work.

Any help?

Thank-You
Jorge
 
I'd use a little macro that increments the cell.

Option Explicit
Sub testme()

Dim iCtr As Long
With Worksheets("sheet1")
For iCtr = 1 To 5 '500 when done testing!
.Range("A1").Value = iCtr
.PrintOut preview:=True
Next iCtr
End With

End Sub

Adjust the worksheet name (I used Sheet1). The address of the cell (I used A1).

Change the 5 to 500 when you're done testing and get rid of the "preview:=true"
line. (It's there just to save paper.)

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

Dave I'll try this.
If I wanted to start at ("501 To 525") for the next batch - I'd have to
change the macro correct?

Jorge
 
Yep.

If you do this lots, you could have the macro ask you for starting and ending
numbers.

Option Explicit
Sub testme()
Dim iCtr As Long
Dim FirstNumber As Long
Dim LastNumber As Long
Dim TempNumber As Long

FirstNumber = Application.InputBox("First#", Type:=1)
If FirstNumber < 1 Then
Exit Sub
End If

LastNumber = Application.InputBox("Last#", Type:=1)
If LastNumber < FirstNumber Then
Exit Sub
End If

With Worksheets("sheet1")
For iCtr = CLng(FirstNumber) To CLng(LastNumber)
.Range("A1").Value = iCtr
.PrintOut preview:=True
Next iCtr
End With

End Sub
 
Well, then you should modify it!!!

Check to make sure the numbers pass the giggle test--stop from entering 1 to
1,000,000.

(or just be careful and invest in a paper mill <bg>)
Oh too kewl....
This all works wonderful!

George
 
LOL

Luckily one client is 1-500
Others are very low...

Thank you for your help sir!
Jorge'
 
Back
Top