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 ?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You'll need to provide more details. Is this on a userform or a worksheet. Where is the cntrl #?
 
Upvote 0
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?)
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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:
Upvote 0
Press ALT + F11 to open the Visual Basic Editor. Double click ThisWorkbook shown in the Project window.
 
Upvote 0

Forum statistics

Threads
1,212,938
Messages
6,110,788
Members
448,297
Latest member
carmadgar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top