View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default Print a preset group of pages

David wrote


Something like:
StudentArr=("student1","student2","student3")
L = StudentArr
For i = Lbound(L) To Ubound(L)
Application.Find (i)
Application.PrintOut what:= that page
Next i



Here's some code I found and adapted for testing for a single name:

Sub test()
Dim VPC As Integer, HPC As Integer
Dim HPB As HPageBreak
Dim NumPage As Integer
Range("A:A").Find(What:="turner, david").Activate
HPC = ActiveSheet.HPageBreaks.Count + 1
VPC = 1
NumPage = 1
For Each HPB In ActiveSheet.HPageBreaks
If HPB.Location.Row ActiveCell.Row Then Exit For
NumPage = NumPage + VPC
Next HPB
Sheets(1).PrintOut From:=NumPage, To:=NumPage, Preview:=True '<would change
to actually print
End Sub

Can someone show me how to process an array of names?
--
David