» 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:
- Millionaire Real Estate Mentor : The Secrets of Financial Freedom through Real Estate Investing
- Financial Shenanigans : How to Detect Accounting Gimmicks & Fraud in Financial Reports
- Treason: Liberal Treachery from the Cold War to the War on Terrorism
- Personal Finance for Dummies
- Excel 2002 Power Programming with VBA
- Windows XP Pocket Reference
No comments have been submitted.

