» 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:
- Definitive Guide to Excel VBA
- Analyzing Markets, Products, and Marketing Plans
- Not-for-Profit Accounting Made Easy
- H&R Block's Just Plain Smart(tm) Tax Planning Advisor: A year-round approach to lowering your taxes this year, next year and beyond
- How to Read A Financial Report
- The Analysis and Use of Financial Statements
No comments have been submitted.

