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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,216,091
Messages
6,128,772
Members
449,468
Latest member
AGreen17

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