From: Subodh on 23 Feb 2010 22:28 Dear Friends, I want a workbook to have the same header (as some cell value of a sheet in workbook) and similarly same titles (rows and columns titles) in different sheets. I reached to the following code. It worked well for the header (and also footer) but it didn't work for the rows to repeat at top or columns to repeat. It only works for the active sheet. How can i make my work done?? The main problem i think is to make ActiveSheet.PageSetup.PrintTitleRows work across multiple sheets. Please help me. I have the code attached here for yur reference. 'this is the workbook code Private Sub Workbook_BeforePrint(Cancel As Boolean) getcellheader End Sub 'this is the module code Sub getcellheader() Set datasht = ThisWorkbook.Sheets("DataSheet") With ActiveSheet.PageSetup .RightHeader = "" .LeftHeader = datasht.Range("a9").Text ' .CenterHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" End With ActiveSheet.PageSetup.PrintTitleRows = ThisWorkbook.Sheets("DataSheet").Rows("1:3").Address ActiveSheet.PageSetup.PrintTitleColumns = ActiveSheet.Columns("A:C").Address End Sub
|
Pages: 1 Prev: rt error 1004 Next: Full Script for Excel Spreadsheet Import Automation |