View Single Post
 
Old 08-02-2016, 12:01 AM
excelledsoftware excelledsoftware is offline Windows 10 Office 2007
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Something like this should be able to get you started.

Code:
Sub PrintAndNumber()
  Dim totalSheets As Integer, rangeForNumber As Range, rangeString As String
  Dim x As Integer, wb As Workbook, ws As Worksheet
  
    'change how many sheets you want here.
    totalSheets = 5
    'change the cell where you want the page number to go
    rangeString = "A1"
    
    
    'auto setup
    Set wb = ThisWorkbook
    Set ws = wb.ActiveSheet
    Set rangeForNumber = ws.Range(rangeString)
    For x = 1 To totalSheets
      rangeForNumber.Value = x
      ws.PrintOut
    Next x
      
End Sub
Let me know if you have any questions.

Thanks
Reply With Quote