Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
capture WEEKNUM & place in page setup
Thanks in advance. I have a spreadsheet where I setup the
page to break every Saturday (thanks Dave P.). So each page contains Mon to Sat. My spreadsheet dates begin in column A2. I would like to print the WEEKNUM of each page on the page setup footer based on the first date of each page. How would I do this? I am not sure if I have to capture the WEEKNUM when I set the Page Breaks, code below, and then reference the capture on page setup or do it all on the page setup coding. Sub mcrAddBreaks() Worksheets("Final").Activate Worksheets("Final").Range("A1").Select Dim StartRow As Long Dim FinalRow As Long Dim FVal As Date Dim FirstVal As Long Dim NVal As Date Dim NextVal As Long Dim i As Integer StartRow = 2 FinalRow = Range("A65536").End(xlUp).Row For i = StartRow To FinalRow FVal = Cells(i, 1).Value NVal = Cells(i + 1, 1).Value FirstVal = Weekday(FVal) NextVal = Weekday(NVal) If (FirstVal = 7) And (NextVal = 2) Then ActiveSheet.HPageBreaks.Add befo=Cells(i + 1, 1) End If FVal = NVal Next i End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Page layout - page setup - items disabled | Excel Discussion (Misc queries) | |||
CAPTURE INFO FROM PAGE TO PAGE | Excel Discussion (Misc queries) | |||
HOW DO I SETUP A PAGE IN EXCEL TO GIVE TOTALS TO ANOTHER PAGE | Excel Worksheet Functions | |||
Under Page Setup the page option of Ledger - for Office XP | Excel Discussion (Misc queries) | |||
screen capture of page | Excel Worksheet Functions |