View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Check how date is entered

On 5/4/2018 4:37 PM, GS wrote:
...

Hmm.., I rather like Auric's simplified solution since it indeed does
EXACTLY what I interpret the OP is looking to accomplish.

...

Well, it'll tell him what the cell is formatted as; whether that's what the
data was when entered isn't determinable from the string which is where _I_
thought OP was coming from... :)

Once it's in the cell it can be either depending on the format; is that
correct or not is still indeterminate.


Date data will display as various values according to cell.NumberFormat for
Dates. If the cell containing a date is General format then the system date
format will display.

Ambiguities arise when *numeric representation* displays as opposed to *textual
representation* displaying. Auric's code determines whether the 1st element
represents d or m. Isn't this what the OP wants to figure out?

FWIW:
I prefer to use textual representation for dates as...

Where year is assumed to be current, May-4, 4-May
(ie: an accounting ledger/journal for a specific fiscal)

Where year is not assumed: May-4, 2018, May-4-2018, 4-May, 2018, ...

...where the NumberFormat is defined in Custom as "mmm-d" or as respective to
the desired display. This way, it doesn't matter what the system format is and
so there's no ambiguity whatsoever.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion