» Create day sheets of a month without weekends and holidays using VBA
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
Answer: Enter the following Code with Excel5/7 in an ModuleSheet, with Excel8 in a general Module, assign it to a Button and run it.
Place the code below into the standard module
Sub CallingMonths()
Application.ScreenUpdating = False
Call MonthApply(2000, 12)
Application.ScreenUpdating = True
End Sub
Sub MonthApply(intYear As Integer, intMonth As Integer)
Dim datDay As Date
Dim dblDay As Double
Dim rngFind As Range
For dblDay = DateSerial(intYear, intMonth, 1) To _
DateSerial(intYear, intMonth + 1, 0)
Set rngFind = Worksheets("Holidays").Columns(1). _
Find(DateValue(Format(DateSerial(intYear, intMonth, 1), "dd.mm.yy")), LookIn:=xlFormulas)
If rngFind Is Nothing And WorksheetFunction.WeekDay(dblDay) < 6 Then
Worksheets.Add.Move after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(dblDay, "dd.mm.yy")
End If
Next dblDay
Worksheets(1).Select
End Sub
Book Store:
Recommended Books:
- Microsoft Windows XP Inside Out
- Financial Modeling - 2nd Edition
- The New Financial Order: Risk in the Twenty-First Century
- Special Edition Using Microsoft Word 2002
- Keys to Reading an Annual Report (Barron's Business Keys)
- The South Beach Diet: The Delicious, Doctor-Designed, Foolproof Plan for Fast and Healthy Weight Loss
No comments have been submitted.

