LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page layout - page setup - items disabled Bill D - Hubbard & Co Excel Discussion (Misc queries) 6 February 2nd 10 04:34 PM
CAPTURE INFO FROM PAGE TO PAGE Jenny Excel Discussion (Misc queries) 1 June 23rd 09 09:28 PM
HOW DO I SETUP A PAGE IN EXCEL TO GIVE TOTALS TO ANOTHER PAGE Randy Excel Worksheet Functions 1 February 8th 07 06:15 PM
Under Page Setup the page option of Ledger - for Office XP Turbo Excel Discussion (Misc queries) 2 September 27th 06 02:46 AM
screen capture of page Juco Excel Worksheet Functions 2 March 13th 05 12:50 AM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"