Visual Basic for Applications (VBA)
Hi
A few functions ...
Day - day in the month
Month - month in the year
Year - year number
Weekday - day number in week
WeekdayName - name of weekday
Format - returns a variant containing an expression formatted according to instructions
Is this what you were looking for
Regards
PeterMo.
Dim dateit As Date
Dim curdate As date
curdate = Date
dateit = DateSerial(year(curdate), month(curdate), 1)
Hi
Maybe this sample code will help ...
Dim wsNo As Integer
Dim ThisDate As Date
Dim NextMonth As Date
Dim ThisMonth As Integer
Dim ThisYear As Integer
Dim ThisDay As Integer
ThisMonth = Month(Date)
ThisYear = Year(Date)
NextMonth = DateSerial(ThisYear, ThisMonth + 1, 1)
For wsNo = 1 To 31
ThisDate = DateSerial(ThisYear, ThisMonth, wsNo)
ThisDay = Weekday(ThisDate, vbSunday)
If ThisDate >= NextMonth Or _
ThisDay = vbSaturday Or _
ThisDay = vbSunday Then
Sheets(wsNo).Visible = False
Else
Sheets(wsNo).Visible = True
Sheets(wsNo).Name = Format(wsNo, "00 ") & _
MsgBox "Done"
Regards
Peter Mo.