VBA DEVELOPER WORLD

Welcome to VBA Tips & Tricks. All VBA related information will be posted on this blog. Of late, VBA has been disregarded by many software professionals for .Net, c# and other technologies. This blog will also post articles related to them too Happy reading

Friday, July 6, 2012

WeekStartDate

Function WeekStartDate(intWeek As Integer, intYear As Integer) As Date


Dim FromDate As Date, lngAdd As Long

If intYear < 1 Then intYear = Year(Date) ' the current year

FromDate = DateSerial(intYear, 1, 1)

If Weekday(FromDate, vbMonday) > 4 Then lngAdd = 7

WeekStartDate = FromDate + ((7 * intWeek) - 6) - _

Weekday(FromDate, vbMonday) + lngAdd

End Function
Posted by VBA DEVELOPER at 1:09 AM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2013 (16)
    • ►  March (4)
    • ►  February (5)
    • ►  January (7)
  • ▼  2012 (56)
    • ►  December (6)
    • ►  November (5)
    • ►  October (5)
    • ►  August (5)
    • ▼  July (5)
      • Count by color
      • WeekStartDate
      • Using Without With-End With Statement
      • Avoiding Excel’s Questions
      • Speeding Up Your Macros:- Application.ScreenU...
    • ►  June (5)
    • ►  May (5)
    • ►  April (5)
    • ►  March (5)
    • ►  February (5)
    • ►  January (5)
  • ►  2011 (50)
    • ►  December (8)
    • ►  November (12)
    • ►  October (5)
    • ►  September (5)
    • ►  August (5)
    • ►  July (5)
    • ►  March (5)
    • ►  January (5)
  • ►  2010 (72)
    • ►  December (5)
    • ►  November (7)
    • ►  October (6)
    • ►  September (8)
    • ►  August (5)
    • ►  July (6)
    • ►  June (5)
    • ►  May (5)
    • ►  April (10)
    • ►  March (5)
    • ►  February (5)
    • ►  January (5)
  • ►  2009 (10)
    • ►  December (8)
    • ►  November (2)
  • ►  2007 (2)
    • ►  November (2)

About Me

VBA DEVELOPER
View my complete profile
Simple theme. Theme images by luoman. Powered by Blogger.