Auto Number

aswain

New Member
Joined
Jul 30, 2010
Messages
7
Have a Shipper Form created with an inventory cntrl # and I need that number to increment by 1 after I click the print function. Is this even possible ?
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
You'll need to provide more details. Is this on a userform or a worksheet. Where is the cntrl #?
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Hi aswain, welcome to the board.
What do you mean by 'click the print function'?
Are you using your own routine (macro) to do the printing?
If so it would be easy to add a line to make it do that.

If not (or you just can't count on the users to always use your routine) then perhaps we could come up with something that'll work in the Workbook_BeforePrint event.
(Just guessing but I would think it's most easily done by incrementing your counter just before printing rather than after.... would that be an option for you?)
 

aswain

New Member
Joined
Jul 30, 2010
Messages
7
the inventory cntrl# is in cell H11 it is just a worksheet that everytime we open it, it needs to have the last number that was printed shown but when we hit print it then needs to increment by 1
 

aswain

New Member
Joined
Jul 30, 2010
Messages
7
Here is how the workbook is layed out. First sheet is our shipper form second sheet is inventory reciept third sheet is a Discrepancy Form , but I only need the Shipper form to be able to change numbers after it is printed, do not want it to auto number until we hit print.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Perhaps this in the ThisWorkbook module

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Shipper" Then
    With Range("H11")
        .Value = .Value + 1
    End With
End If
End Sub
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Try using something like this in your ThisWorkbook module. (Change the sheet name or the A1 reference to your real needs.)
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Sheets("Shipper")
  .Range("A1").Value = .Range("A1").Value + 1
End With
End Sub
Now, if the workbook gets saved before closing, it'll show the last number that was printed when it opens again.

Hope it helps.


[EDIT]
Yeah, check out Vog's idea because I didn't test for which sheet was getting printed so if that matters then... (well, there you go).
 
Last edited:

aswain

New Member
Joined
Jul 30, 2010
Messages
7
Thank You for all of your help, What / where is the workbook module ?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Press ALT + F11 to open the Visual Basic Editor. Double click ThisWorkbook shown in the Project window.
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
(And then press Alt+Q to close the vbe after pasting your code.) ;)
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,009
Messages
5,508,766
Members
408,692
Latest member
OptimalKR

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top