Select Worksheet to print Macro

A

Angel_24477616

The code below is designed to print pallet labels. I have a sheet
where data is entered which is formulated to worksheets named L1 to
L20. I could create 20 different forms with macros attached that have
variations from the one shown below depending on which label I would
like to print. It would be great if I could have one macro that would
select the correct sheet to print based on an input for example. Can
anybody help me?

Also if anybody could refine this code so that the macro runs faster,
that would be much appreciated.

Function RepeatPagePrint(StartPage As Integer, EndPage As Integer,
PageTotal As Integer)


Dim Kount As Integer


For Kount = StartPage To EndPage
Sheets("L1").Select
Range("A1:I44").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$44"
With ActiveSheet.PageSetup
.LeftFooter = "&""Arial,Bold""&48 " & " " & Kount
.CenterFooter = "&""Arial,Bold""&36OF"
.RightFooter = "&""Arial,Bold""&48 " & PageTotal & " "
.CenterHorizontally = False
.CenterVertically = True
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 99
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Next


End Function


Sub DoRepeatPrint()
Dim StPage As Integer
Dim EnPage As Integer
Dim PgTotal As Integer


StPage = 1
EnPage = Val(InputBox("How many Pallets"))
'EnPage = Sheets("Data").Range("K2")
'PgTotal = Sheets("Data").Range("K2")
PgTotal = EnPage

Call RepeatPagePrint(StPage, EnPage, PgTotal)
Sheets("Data").Select
Range("b2").Select



End Sub


Regards,
Angel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top