View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Walter Briscoe Walter Briscoe is offline
external usenet poster
 
Posts: 279
Default Formatting short times

I run VBA in Microsoft Visual Basic 6.5.1053 from Microsoft Office Excel
2003 (11.8332.8333) SP3 from Windows Vista Business Service Pack 2.

I have string data representing minutes and seconds. e.g. "2:30",
"12:00", "25:00"

When I write to a cell with an instruction like activecell = S, the data
is allocated a format from my list of custom formats, either "hh:mm" or
"hh:mm:ss". While I am not bothered that "2:30" is rendered as "02:30",
I am that "25:00" is rendered as "25:00:00".

When I tried activecell = Format(S, "mm:ss"), "12:00" is always
displayed and "hh:mm" is the selected custom format.

I would appreciate code which will satisfy my specific need.
i.e. a format string which renders coherently or otherwise.

I would also appreciate pointers to good documentation, which explains
how cell = value is rendered.

Thanks.
--
Walter Briscoe