View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie David McRitchie is offline
external usenet poster
 
Posts: 903
Default creating repeating headers in a worksheet

weekly_chronology.xls worksheet for 2007
as requested in http://groups.google.com/groups?thre...0microsoft.com


Fill in the information you want to copy down into
rows 1 through 10. With date in cell A2 (as you would show Sun Dec 31, 2006)
bold cells, and format cells in rows 1-10 as wanted

select rows 1-10 and paste to A11
change the date in cell to =A2+7
select row 11, insert (menu), page break
select rows 11:20
Ctrl+C
enter 21:530 into the name box to the left of the address bar
hit "Enter"
Right click to bring up context menu

Inserting page breaks did not work with copies, and you probably
want 5 weeks per page to save paper, looks like you can fit 5 sets
so use the following (or change 50 to 40 for 4 sets per page)

if macros are new to you
see http://www.mvps.org/dmcritchie/excel....htm#havemacro

Sub PageBreak_step50()
Dim CellRange As Range
Dim TestCell As Range
Dim i As Long
ActiveSheet.ResetAllPageBreaks
For i = 50 + 1 To 530 Step 50
ActiveSheet.Rows(i).PageBreak = xlPageBreakManual
Next i
End Sub


if you made a mistake:
to start over enter 21:600 into the name box
insert (menu), clear page breaks
edit, clear, all

Create an Event macro, to get you to the week
Event macros are not the same and are described at
http://www.mvps.org/dmcritchie/excel/event.htm

right-click on the sheet tab
View Code, and insert the following:

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim calc As Long, caddr As Range
calc = (Now() - Range("A2").Value - 1) / 7 * 10
calc = Int(Int(calc) / 10) * 10 + 1
Application.Goto Reference:=Range("A" & calc), scroll:=True
Range("A" & calc).Offset(2, 0).Select
End Sub

--
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"larinoz" wrote in message ...
I need to create a worksheet with a headline that repeats over several rows.

The items in this worksheet need to then be sorted by date and divided into
week beginning sections

ex. row 1 headers Company Product amt.....
Row 2 Week beginning
Row 3 thru 10 then has info for this week

Row 11 would repeat headers
row 12 Week beginning
row 4 thru ? has info

This will then repeat for each week throughout a full year

How do I create these permanent headers that can have an arbitrary # of rows
under each one?

Any help would be greatly appreciated. If I could figure out the template
then it would save me tons of typing/copy and pasting and then I would like
to figure out How I could then enter data and have it sort itself into the
correct week.