![]() |
Printing numbers in Excel. Macro needed.
I would like to use a macro in Excel to print a number in the top
right hand corner onto blank sheets of A4 paper. In Cell M1 I would like to have a text string e.g. Order Number In Cell M2 have the start number In Cell M3 have the number of copies before the number increments (e.g. print 4 sheets with 100 then increment to 101 and print another 4 sheets etc.) In Cell M4 have the total number of "batches" to print. e.g. 10 ( to give 10 * the value in M3) All help appreciated Thanks Ted |
Printing numbers in Excel. Macro needed.
Hi
try the following (not fully tested): Sub print_multiple() Dim copy_count As Integer Dim header_txt As String Dim start_number As Long Dim batches As Integer Dim i As Integer copy_count = Range("M3").Value header_txt = Range("M1").Value & ": " start_number = Range("M2").Value batches = Range("M4").Value For i = 1 To batches With ActiveSheet .PageSetup.RightHeader = header_txt & start_number .PrintOut Copies:=copy_count End With start_number = start_number + 1 Next i End Sub you may have to set the print area before invoking this macro (to prevent printing cells M1:M4) -- Regards Frank Kabel Frankfurt, Germany EddySon wrote: I would like to use a macro in Excel to print a number in the top right hand corner onto blank sheets of A4 paper. In Cell M1 I would like to have a text string e.g. Order Number In Cell M2 have the start number In Cell M3 have the number of copies before the number increments (e.g. print 4 sheets with 100 then increment to 101 and print another 4 sheets etc.) In Cell M4 have the total number of "batches" to print. e.g. 10 ( to give 10 * the value in M3) All help appreciated Thanks Ted |
Printing numbers in Excel. Macro needed.
Hi Frank ....
It does exactly what I require. I really do appreciate your help. You are right I added the print range code to get it to work correctly. This is certainly one for the macro archive. Thanks agian. Ted "Frank Kabel" wrote in message ... Hi try the following (not fully tested): Sub print_multiple() Dim copy_count As Integer Dim header_txt As String Dim start_number As Long Dim batches As Integer Dim i As Integer copy_count = Range("M3").Value header_txt = Range("M1").Value & ": " start_number = Range("M2").Value batches = Range("M4").Value For i = 1 To batches With ActiveSheet .PageSetup.RightHeader = header_txt & start_number .PrintOut Copies:=copy_count End With start_number = start_number + 1 Next i End Sub you may have to set the print area before invoking this macro (to prevent printing cells M1:M4) -- Regards Frank Kabel Frankfurt, Germany EddySon wrote: I would like to use a macro in Excel to print a number in the top right hand corner onto blank sheets of A4 paper. In Cell M1 I would like to have a text string e.g. Order Number In Cell M2 have the start number In Cell M3 have the number of copies before the number increments (e.g. print 4 sheets with 100 then increment to 101 and print another 4 sheets etc.) In Cell M4 have the total number of "batches" to print. e.g. 10 ( to give 10 * the value in M3) All help appreciated Thanks Ted |
All times are GMT +1. The time now is 02:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com