View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Formatting values populated by VB Code

You need to convert seconds to days by dividing by 86400. The format the
cell using this VBA code

Range("A1").numberformat = "HH:MM:SS"

"Dakota" wrote:

I am getting data to show properly in the worksheets being populated by the
VB code, however, I need to convert it and do not know what to do in the VB
code to do this.

For example, I am copying times in seconds '2125' but need it to read in
HH:MM:SS format. I would usually do it in this method: = value/86400 OR
2125/86400 and then format the cell as 'HH:MM:SS' to show the value of:
0:35:25.

Is there something I can do after copying the cell and before its applied to
the cell its supposed to go into?