Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
calculating month of present date
Hey all please let me know how can i calculate month of present date in VBA. At present i can have the first date and present date by txtStartDate = Format(Date - Day(Date) + 1, "dd/mm/yyyy") txtEndDate = Format(Date, "dd/mm/yyyy"). but now i want to calculate MONTH of present date. please help thanks in advance -- anu_manu ------------------------------------------------------------------------ anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510 View this thread: http://www.excelforum.com/showthread...hreadid=516246 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
calculating month of present date
txtMonth.Text = Month(Date)
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "anu_manu" wrote in message ... Hey all please let me know how can i calculate month of present date in VBA. At present i can have the first date and present date by txtStartDate = Format(Date - Day(Date) + 1, "dd/mm/yyyy") txtEndDate = Format(Date, "dd/mm/yyyy"). but now i want to calculate MONTH of present date. please help thanks in advance -- anu_manu ------------------------------------------------------------------------ anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510 View this thread: http://www.excelforum.com/showthread...hreadid=516246 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
calculating month of present date
Thanks Bob But Month(date) returns 01/01/1900 and not 02/01/2006. why is that so? Thanks -- anu_manu ------------------------------------------------------------------------ anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510 View this thread: http://www.excelforum.com/showthread...hreadid=516246 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
calculating month of present date
It is returning an integer, but you've got the cell formatted as date.
Change the format to general or number and you'll get the date "anu_manu" wrote: Thanks Bob But Month(date) returns 01/01/1900 and not 02/01/2006. why is that so? Thanks -- anu_manu ------------------------------------------------------------------------ anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510 View this thread: http://www.excelforum.com/showthread...hreadid=516246 |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
calculating month of present date
i format it as this Format(month(date),"mm/dd/yyyy") isn't it right? Actually,my problem is this.. Currently the Start Date defaults to the first day of the current month. The request is to default the start date to the first day of the quarter (e.g. 01.01, 04.01,07.01,10.01... +year). If the current month is between 1 and 3, default is 01.01.+current year If the current month is between 4 and 6, default is 04.01.+current year Please kindly guide. -- anu_manu ------------------------------------------------------------------------ anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510 View this thread: http://www.excelforum.com/showthread...hreadid=516246 |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
calculating month of present date
StartDate = DateSerial(Year(StartDate), (Month(StartDate) + 2) \ 3, 1)
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "anu_manu" wrote in message ... i format it as this Format(month(date),"mm/dd/yyyy") isn't it right? Actually,my problem is this.. Currently the Start Date defaults to the first day of the current month. The request is to default the start date to the first day of the quarter (e.g. 01.01, 04.01,07.01,10.01... +year). If the current month is between 1 and 3, default is 01.01.+current year If the current month is between 4 and 6, default is 04.01.+current year Please kindly guide. -- anu_manu ------------------------------------------------------------------------ anu_manu's Profile: http://www.excelforum.com/member.php...o&userid=31510 View this thread: http://www.excelforum.com/showthread...hreadid=516246 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing a date back one month | Excel Discussion (Misc queries) | |||
4 and 5 week months | Excel Discussion (Misc queries) | |||
Round date to first of month | Excel Discussion (Misc queries) | |||
How do I show dates older than present date? | Excel Worksheet Functions | |||
Formula for Extracting Month out of a Date column | Excel Discussion (Misc queries) |