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

I should have been more specific...we are converting data to export to
another app which has its own set of data types.

So we want to determine if the Excel user intends for each cell to show as a
Time, Date, Int, Float, Dollar, or Percent.

I was wondering if you can take a FormatString and easily determine if it is
one of those.

"NickHK" wrote:

Number as stored as doubles in Excel. How they are display is determined by
the NumberFormat property.
Not sure what you are after, but maybe one/some of these will be useful.

Range("A1").Value = 123
Debug.Print VarType(Range("A1").Value)
Debug.Print TypeName(Range("A1").Value)
Debug.Print Range("A1").Text
Debug.Print Range("A1").NumberFormat

NickHK

"ALV" wrote in message
...
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.