» Enter the Weekdays Mon - Fri in a Worksheet using VBA in Microsoft Excel
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
I want to enter the Weekdays Mon - Fri in Column A with an empty Cell following and the Date belonging to them in Column B for a pre-determined period. How can I do this with?
Answer:
Use the following Code with Excel5/7 in an English-language, with Excel8 in a general Module and run it.
Place the code below into the standard module
Sub WeekendOut()
Dim Start As Date, Off As Date
Dim y%, i#
Start = InputBox("Start Date:")
Off = InputBox("End Date:")
For i = Start To Off
y = y + 1
If WeekDay(i, 2) < 6 Then
Cells(y, 2) = Format(i, "dd.mm.yy")
Cells(y, 1) = Format(i, "dddd")
ElseIf WeekDay(i, 2) = 6 Then
Else
y = y - 1
End If
Next i
End Sub
Book Store:
Recommended Books:
- Accounting and Financial Fundamentals for Nonfinancial Executives
- Special Edition Using Microsoft Outlook 2002
- Financial Statement Analysis with S&P insert card
- Rich Dad, Poor Dad: What the Rich Teach Their Kids About Money--That the Poor and Middle Class Do Not!
- Microsoft Windows XP Registry Guide
- Getting to Yes: Negotiating Agreement Without Giving In
No comments have been submitted.

