Application.EOMONTH giving wrong answer

baitmaster

Well-known Member
Joined
Mar 12, 2009
Messages
2,042
Edit: Application or Worksheetfunction, both giving same issue

Getting strange results in VBA when trying to work with EOMONTH. Debugging in Immediate I've got:
Code:
?format(WorksheetFunction.EoMonth(clng(Date),0),"dd mmm yyyy")
I'm expecting it to return 28 Feb 2018 but it's coming up with the 27th instead. Any ideas why?
I'm using CLNG because I'm in the UK and without it I'm getting an answer in 2010, trying to rule out US/UK date issues

Is there a known instability with VBA EOMONTH? Or is the answer staring me in the face but I just can't see it?!

Using Office Pro Plus 2013

Thanks
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Wow, Jonmo -- good shot!

It's peculiar that that causef EF.EOM to fail but not EOMONTH in Excel.
 
Last edited:
Upvote 0
Yep, And I still don't understand why the EOMONTH (in vba with WorksheetFunction) would be the 27th
 
Last edited:
Upvote 0
Thanks Jonmo, that was indeed the correct answer! The file was built off a dataset sent to me from an iPad which explains how this snuck in. Note to self: continue to dislike Apple products
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top