» Enter the Weekdays Mon - Fri in a Worksheet using VBA in Microsoft Excel
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
Question: 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:
- Learn MS Excel 2002 VBA/XML Programming
- Microsoft Office XP Step-By-Step (With CD-ROM)
- The Fall of Advertising and the Rise of PR
- Financial Modeling - 2nd Edition
- Harry Potter and the Order of the Phoenix (Book 5)
- AWAKEN THE GIANT WITHIN : HOW TO TAKE IMMEDIATE CONTROL OF YOUR MENTAL, EMOTIONAL, PHYSICAL AND FINANCIAL
No comments have been submitted.

