End Of Month

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

How can I detect if the End Of the month has been reached
from within VBA

I know you can use EOMONTH in Excel, is it available in
VBA?

Pete
 
Try this Pete

If Month(Date) <> Month(Date + 1) Then MsgBox "This is the last day"
 
Pete said:
How can I detect if the End Of the month has been reached
from within VBA

I know you can use EOMONTH in Excel, is it available in
VBA?

Pete

Assuming you have a date in A1, you could use this formula

=IF(A1=DATE(YEAR(A1),1+MONTH(A1),0), TRUE, FALSE)

I got the idea from http://www.mrexcel.com/td0053.html

/Fredrik
 
Hi,

If you want to verify that today is the end of the month

If Day(Date+1) = 1 Then Msgbox "End of Month"

Replace Date with any other variable, should you need to.

Regards,

Daniel M.
 
Monthend = Application.Run("ATPVBAEN.XLA!EOMONTH", Range("daterange").Value,
1)
 
And if you set a reference to the ATP in the VBE (Tools/References, check
ATPVBA), you can write it as

MonthEnd = EOMONTH(Range("DateRange").Value)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top