Auto increment A1 cell after each printing

Harry Geda

Board Regular
Joined
Mar 4, 2010
Messages
153
Hello,

I would like to auto increment the cell A1 after every print.
Also if possible to have the luxury of entering a value in B1 for print quantity.
A1 should increment before printing the next print.
I am using the A1 as a serial number generator inside the form.

I am new to this. Only copied one macro before this.

Thank you,
Harry:confused:
 
HI, this is the first time i join this forum i benefited so much from the threads posted .
i am not good with macros , i am still learning i cam across this code that i used it worked for me partially . and this what i am trying to do
i created an excel sheet with a user form the user for has a command button to print one page every time time i send data from the user form to the sheet i click print i apply this code from the forum to insert an incremental cell to let me know the number of pages or jobs created. when i click the print command the cell shows the incremental page numbers
but i won't print the sheet can you please help me out figure out this issue thank you and this is the code
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
With Sheets("Sheet1")
.Range("j30").Value = .Range("j30").Value + 1
.PrintOut copies:=.Range("d27").Value
End With
Application.EnableEvents = True
End Sub
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
That sounds like you are clicking the print button on the print dialog. Don't.

VoG, I want to test out your code but i'm a newbie in VB.
After I pasted the code how should I print the file that I want? What command should I do to print a test with what I have done?

Thanks
 
Upvote 0
This is just what I was looking for! I did have to make a couple of adjustments:

Sub Print_Sequence()
'
' Print_Sequence Macro
'

'
Dim i As Long
Cancel = True
Application.EnableEvents = False
Application.Dialogs(xlDialogPrinterSetup).Show
With ActiveWindow.SelectedSheets
For i = 1 To Range("M1").Value
.PrintOut
Range("C6").Value = Range("C6").Value + 1
Next i
End With
Application.EnableEvents = True

End Sub


I inserted a module and pasted the code there. Changed it to work on the active sheet. Removed periods before Range in the code which kept giving me an error message. Moved the increment to occur after the first print. Then I created a button, assigned the macro and voila' all is good. :)
 
Upvote 0

Forum statistics

Threads
1,216,025
Messages
6,128,358
Members
449,444
Latest member
abitrandom82

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