Search This Blog

Wednesday 16 January 2013

Finding Current Month Last Date DAY name ?

Dim mon,a
mon=Month(Now)
curDate=date
'MsgBox curDate
YY=year(curDate)
Y=YY
Select Case mon
Case "1" 
  MsgBox "Jan"
  j="31-01-"&Y
  MsgBox j
Case "2"  
  MsgBox "Feb"
  j="28-02-"&Y
  MsgBox j
Case "3"
  MsgBox "Mar"
  j="31-03-"&Y
  MsgBox j
Case "4" 
  MsgBox "April"
  j="30-04-"&Y
  MsgBox j
Case "5"  
  MsgBox "May"
  j="31-05-"&Y
  MsgBox j
Case "6"
  MsgBox "June"
  j="30-06-"&Y
  MsgBox j
Case "7" 
  MsgBox "July"
  j="31-07-"&Y
  MsgBox j
Case "8"  
  MsgBox "Aug"
  j="31-08-"&Y
  MsgBox j
Case "9"
  MsgBox "Sep"
  j="30-09-"&Y
  MsgBox j
Case "10" 
  MsgBox "Oct"
  j="31-10-"&Y
  MsgBox j
Case "11"  
  MsgBox "Nov"
  j="30-11-"&Y
  MsgBox j
Case "12"
  MsgBox "Dec"
  j="31-12-"&Y
  MsgBox j
End Select
c=Weekday(j)
a=WeekdayName(c)
MsgBox a

Note : You can check this code by changing the system date in different years.

No comments:

Post a Comment