ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing time format to numeric (https://www.excelbanter.com/excel-programming/359488-re-changing-time-format-numeric.html)

Geoff

Changing time format to numeric
 
Thanks for all the responses but they unfortunately still don't resolve my
problem. While this works fine when modifying Excel manually on the
worksheet, I need to be able to do it with the use of code which so far I
have been unable to do.

The code I tried was
xlApp.Application.Range(A8:H38) = xlApp.Application.Range(Cells(8, 8),
Cells(36, 8)).Value *24

Also the range to be changed is not actually A8:H36 - it is A8 to end of
file as all the worksheets are of different length with differing amounts of
rows. Any ideas on what I'm doing wrong guys?

"Andrew Taylor" wrote:

Multiply by 24 and format as General.

Geoff wrote:
How do I programatically change a derived time format displayed as 8:00:00
(hours - derived from a formula finish time minus start time) to the numeric
format 8 in a cell - can it be done?




Arvi Laanemets

Changing time format to numeric
 
Hi

You can multiply in this way the value in single cell. To do so with a
range, you or cycle through cells in range, and multiply every cell value
with 24 separately, or you use an VBA equivalent for a technique, where you
copy some cell with value 24 in it, and then use PasteSpecialMultiply on a
range with time values.


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"Geoff" wrote in message
...
Thanks for all the responses but they unfortunately still don't resolve my
problem. While this works fine when modifying Excel manually on the
worksheet, I need to be able to do it with the use of code which so far I
have been unable to do.

The code I tried was
xlApp.Application.Range(A8:H38) = xlApp.Application.Range(Cells(8, 8),
Cells(36, 8)).Value *24

Also the range to be changed is not actually A8:H36 - it is A8 to end of
file as all the worksheets are of different length with differing amounts
of
rows. Any ideas on what I'm doing wrong guys?

"Andrew Taylor" wrote:

Multiply by 24 and format as General.

Geoff wrote:
How do I programatically change a derived time format displayed as
8:00:00
(hours - derived from a formula finish time minus start time) to the
numeric
format 8 in a cell - can it be done?







All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com