Currently I have these 2 codes on this report:
And they work great for the most part. The problem I am having is that right now if a single sheet goes onto extra pages within the sheet, all pages within the sheet keep the same page number. SO when it prints out the entire report the page number in the bottom shows up something along the lines of "Page 1" then "Page 2", "Page 2", "Page 2", "Page 3". Which apparently can get confusing to the customer.
So I need to modify the above codes to add in those pages towards the page count and then also change the numbering in the index to match.
Now it doesn't matter if it just shows the start page or if it shows the range of pages (ie 1 - Pinion; 2-4 - Impeller; 5 - Laby Sleeve OR 1 - Pinion; 2 - Impeller; 5 - Laby Sleeve).
I know this is a tough one and sorry for the long post but I may not be on for a few days and wanted to give you guys all the info I could for now.
Thanks in advance.
Code:
Sub SequentiallyNumberVisiblePagesOnly()
Dim lx As Long
Dim lVisibleSheets As Long
For lx = 1 To Worksheets.Count
If Worksheets(lx).Visible = True Then lVisibleCount = lVisibleCount + 1
With Worksheets(lx).PageSetup
.RightFooter = lVisibleCount
End With
Next
End Sub
Sub IndexNumber()
Dim lx As Long
Dim sIndex As String
Dim sIndexStartRange As String
Dim lVisibleCount As Long
sIndex = "Index"
sIndexStartRange = "A7"
Worksheets(sIndex).Range("A7:A100").Cells.ClearContents
With Worksheets(sIndex).Range("A7")
For lx = 1 To Worksheets.Count
Select Case Worksheets(lx).Name
Case Else
If Worksheets(lx).Visible = True Then
lVisibleCount = lVisibleCount + 1
End If
If Worksheets(lx).Visible = True Then .Offset(lx - 1, 0) = lVisibleCount
End Select
Next
End With
End Sub
And they work great for the most part. The problem I am having is that right now if a single sheet goes onto extra pages within the sheet, all pages within the sheet keep the same page number. SO when it prints out the entire report the page number in the bottom shows up something along the lines of "Page 1" then "Page 2", "Page 2", "Page 2", "Page 3". Which apparently can get confusing to the customer.
So I need to modify the above codes to add in those pages towards the page count and then also change the numbering in the index to match.
Now it doesn't matter if it just shows the start page or if it shows the range of pages (ie 1 - Pinion; 2-4 - Impeller; 5 - Laby Sleeve OR 1 - Pinion; 2 - Impeller; 5 - Laby Sleeve).
I know this is a tough one and sorry for the long post but I may not be on for a few days and wanted to give you guys all the info I could for now.
Thanks in advance.