Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Friday of a given week

Sub AddFridays()
RowNum = 1
MyYear = 2009
NewYears = DateSerial(MyYear, 1, 1)
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
DayofWeek = Weekday(NewYears, vbFriday)
FirstFriday = NewYears + ((8 - DayofWeek) Mod 7)

'add new row
Rows(RowNum).Insert

For ColCount = 1 To LastCol
WeekNum = Cells(RowNum + 1, ColCount)
FridayofWeek = FirstFriday + (7 * (WeekNum - 1))
Cells(RowNum, ColCount) = Format(FridayofWeek, "yyyy-mmm-dd")
Next ColCount


End Sub


"QB" wrote:

I have a row with week numbers and would like to insert a row above it which
list the Friday of that week number. How can I do this?

Week 19 would give 2009-May-08 (yyyy-mmm-dd)

Thank you

QB

Reply
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
6 Day working week (friday holiday) Dan Johns Excel Worksheet Functions 2 January 9th 10 06:01 PM
Friday of a given week Rick Rothstein Excel Programming 0 May 7th 09 05:57 PM
Friday date of next week.. deepika :excel help[_2_] Excel Discussion (Misc queries) 3 February 13th 08 01:20 PM
Week Ended Friday Tony Excel Worksheet Functions 4 September 20th 07 03:00 PM
Finding Friday in week number DavidS New Users to Excel 5 October 24th 06 10:04 AM


All times are GMT +1. The time now is 07:25 PM.

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"