View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
gerdmain gerdmain is offline
external usenet poster
 
Posts: 13
Default Determine format type from strings

Hi ALV,

Not quite sure what you mean. A numeric cell has a value, say 39113.542130787
The Numberformat for this cell only determins how this number is to be
displayed on the sheet, but it does not change the value itself. The format
is related to the meaning of the value. My example could mena today's date
and time, or my bank balance (not really) and I would format it accordingly.

It appears you want to go the other way. You expect the format of a cell to
indicate the meaning of the value, which could work (depending on the source
of the data) but only if the few standard formats are being used. As soon as
a cell is formatted with a Custom-format, which by definition is flexible,
there will always be new formats.

Not sure what you mean by integer (no decimals displayed?) or float
(scientific?).

Do you mean the type of a variable? This could be interger. If so, see
vartype in VBA help.



--
Gerd


"ALV" wrote:

Does anyone know if there is an easy or automated way to take a format string
for a numeric cell and determine if it's an Int, Float (with num decimals),
Date, or Time?

Right now we are using a large switch, but there are always new formats that
fall through and end up with the wrong type.

Thanks.