Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default 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)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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/

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/

.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default 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/

.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default 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/

.

  #8   Report Post  
Posted to microsoft.public.excel.programming
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/

.







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
finding the last day of the month Charles Excel Discussion (Misc queries) 4 September 17th 07 08:04 PM
Finding Particular Day of Month DF Excel Worksheet Functions 7 April 21st 07 02:44 PM
Finding the last day of a month comotoman Excel Discussion (Misc queries) 3 October 18th 05 11:12 PM
Finding the Sum of value each month Pjcan1 Excel Discussion (Misc queries) 6 June 15th 05 09:33 PM
Finding min and max date of a given month Caro-Kann Defence Excel Worksheet Functions 2 May 13th 05 06:33 PM


All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"