ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date function (https://www.excelbanter.com/excel-programming/384330-date-function.html)

Chinx21

date function
 
help pls.. how can I get the month of a whole date. example March 2, 2007.
should return only the Month which is March.Thanks!

NickHK

date function
 
Various ways:

Private Sub CommandButton1_Click()
Dim TheMonth As Long

TheMonth = Month(Now())
Debug.Print TheMonth
Debug.Print MonthName(TheMonth, False)
Debug.Print MonthName(TheMonth, True)
Debug.Print Format(Now(), "dd/mmmm/yyyy")
End Sub

NickHK

"Chinx21" . wrote in message
...
help pls.. how can I get the month of a whole date. example March 2, 2007.
should return only the Month which is March.Thanks!




Karthik Bhat - Bangalore[_2_]

date function
 
If Cell A1 has the date. Write the following formual in any other
cell...
=TEXT((A1),"MMMM")
Now this cell will have the month.

Thx
Karthik


Jean-Yves[_2_]

date function
 
Hi,

and also
msgbox datepart("m",now)
msgbox monthname(datepart("m",now))
msgbox monthname(datepart("m","March 2, 2007"))

Look in help for the DatePart Function
Regards
JY

"Chinx21" . wrote in message
...
help pls.. how can I get the month of a whole date. example March 2, 2007.
should return only the Month which is March.Thanks!





All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com