Thread: Print Rows
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Print Rows

One way:

Dim mySheetNames as variant
dim iCtr as long

mysheetnames = array("sheet1", "sheet99", "anothersheetnamehere")

for ictr = lbound(mysheetnames) to ubound(mysheetnames)
with worksheets(mysheetnames(ictr))
'do your stuff
end with
next ictr



Dean wrote:

Ok, for a 3rd time, this time with msnews.microsoft.com as my default, I am
going to attempt a reply!

I thank you very much. Can you tell me how to change the font size, maybe
even bold fonted? Also, your command:

<< With Worksheets("WhichOne")

suggests I can program this for multiple worksheet names, yet "which one"
suggests only one. To do more than one, do I use commas between names. And
will that allow me to print only one of the sheets (for a single print job)
or would it somehow insist I print all the sheets listed?

Thanks!
Dean

"NickHK" wrote in message
...
Dean,
How about :

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Cell As Range
Dim HeaderStr As String

For Each Cell In Range("HeaderCells")
HeaderStr = HeaderStr & Cell.Value & vbCr
Next
'Remove last vbCr
HeaderStr = Left(HeaderStr, Len(HeaderStr) - 1)

With Worksheets("WhichOne")
.PageSetup.CenterHeader = HeaderStr
End With

End Sub

NickHK

"Dean" wrote in message
...
I have a worksheet that will be printed one page high and 2 or 3 pages
wide
(varies, based on how many columns get hidden, which varies by scenario).
I
would like cells A1 through A4 (or wherever it is best to put them) to be
repeated at the top of each page. Unfortunately, particularly on the
first
page, some columns will be hidden and this is a variable.

How can I make these four cells print out at the top (and center) of each
page?

I thought about a custom header, instead, but it doesn't seem like the
header can be based on a cell contents, which seems to be what I need.

Any ideas?

Thanks much,
Dean



--

Dave Peterson