return max date not working correctly

cthorn112

New Member
Joined
Apr 27, 2011
Messages
21
I have the following dates 4/1/2011, 4/2/2011, 4/8/2011, 4/9/2011, 4/15/2011, and 4/16/2011. If I ask to return the max date it returns 4/2/2011 instead of returning 4/16/2011. I believe this is due to the fact that excel treats 4/2/2011 as is instead of 4/02/2011. I have one possible solution which might seem like more work then needed (writing code that will add a leading 0 if the day is only 1 digit). Before going down that path does anyone have any ideas or suggestions ? Please let me know and thanks in advance.

Code:
Dim job_completed As Range

Set job_completed = Sheets("PROMOTER_TEMPLATE2").Range("B16:B21")
Sheets("PROMOTER_TEMPLATE2").Range("B12").Value = Application.WorksheetFunction.Max(job_completed)

-Chris
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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