I've searched on the internet, but I couldn't find the vba MAX with a case
where the values to be found as max value is something like this "PA-190909xxx".
The "190909" is based on a formatted current date "yymmdd"
Sometimes the user need to know what is the last invoice number of current date.
For example, in the "DATA" worksheet the invoice numbers are :
PA-190909134
PA-190909142
PA-190909143
PA-190909171
PA-190909120
So he wants the code to show him a message box,
something like "The last invoice number of today is PA-190909171"
rather than he select the sheets DATA, then search the rows to find the latest invoice number.
What I've tried :
LastInvNumber = Application.WorksheetFunction.Max(Sheets("DATA").Right(Range("C:C"), 9))
MsgBox LastInvNumber
Which of course it doesn't work.
So how is the code to get that kind of message box ?
Any kind of respond would be greatly appreciated.
Thank you in advanced.
Bookmarks