» Calculate a weeks start date using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Custom Functions , Printing in VBA
VERSION - All Microsoft Excel Versions
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
Book Store:
Recommended Books:
- The Laws of Money, The Lessons of Life: Keep What You Have and Create What You Deserve
- Fish! A Remarkable Way to Boost Morale and Improve Results
- Mastering Excel 2000 (for beginner)
- Essentials of Investments with Standard & Poor's Educational Version of Market Insight + PowerWeb + Stock Trak Coupon
- How to Use Financial Statements: A Guide to Understanding the Numbers
No comments have been submitted.

