View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Finding the Last Day in the month

mm - I guess I wasn't very clear :)

What I meant was DateSerial interprets each argument as an offset from 1

eg.
DateSerial(2004, 1, 1 + 100) is the same as saying 100 days from 1-Jan-2004


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Tom Ogilvy" wrote in message
...
The code behind the function actually interprets it as
DateSerial(Year(Date), Month(Date) + 1, 1 - 1)


In most cases that I can think of 1 - 1 would be interpreted as zero.

<g

I suspect you meant to say it is interpreted as

DateSerial(Year(Date), Month(Date) + 1, 1) - 1

--
Regards,
Tom Ogilvy


"Rob van Gelder" wrote in message
...
Even shorter:
DateSerial(Year(Date), Month(Date) + 1, 0)

The code behind the function actually interprets it as
DateSerial(Year(Date), Month(Date) + 1, 1 - 1)

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Frank Kabel" wrote in message
...
Hi
try something like the following for getting the last date
of the current month
Expirydate=DateSerial(Year(date),Month(date)+1,1)-1



-----Original Message-----
Could somewhat please tell me how i can find out the last
day in the
month using VBA.

I want to assign a variable called ExpiryDate to be the
last day in the
month.

Also i would need the variable to be in String format.

Any help appreciated.

Thanx


---
Message posted from http://www.ExcelForum.com/

.