ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding the Last Day in the month (https://www.excelbanter.com/excel-programming/296267-finding-last-day-month.html)

Jako[_6_]

Finding the Last Day in the month
 
Could somewhat please tell me how i can find out the last day in th
month using VBA.

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

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

Any help appreciated.

Than

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


Frank Kabel

Finding the Last Day in the month
 
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/

.


Melanie Breden

Finding the Last Day in the month
 
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.


ty this:

Dim ExpiryDate As String
ExpiryDate = CStr(DateSerial(Year(Date), Month(Date) + 1, 0))


--
Mit freundlichen Grüssen

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)


Rob van Gelder[_4_]

Finding the Last Day in the month
 
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/

.




Tom Ogilvy

Finding the Last Day in the month
 
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/

.






David

Finding the Last Day in the month
 
Finds last day of month for the current month. Think you
have to have analysis addin installed.

=EOMONTH(A27,0)

-----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/

.


SidBord

Finding the Last Day in the month
 
If you were working with regular formulas, I'd say go to
TOOLS-ADDINS and add the Analysis Toolpack, which contains
the function EOMonth. However, I don't think you'll be
able to use it in VBA. You could try something like
Application.EOMonth(Date,0) and see if it works.
-----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/

.


Rob van Gelder[_4_]

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/

.









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

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