Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Time arithmetic

hi,

I have a cell (G11) whose format is [h]:mm to store hours worked in a week.
I need to use that in a VBA function. If I query G11.value I get a
non-integer number (I DO know that Excel stores time internall like that).
How can I get in a VBA procedure exactly what is see in the cell..e.g if
someone worked 35:15 hours, I want to be able to get 35:15 in the procedure.
I need to strip it from there to work out payment, eg (hourly rate * 35) +
(hourly rate * (15/60)/100).

I have tried using format but it does not like the "[h].mm" argument.

any help is much appreciated.

Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Time arithmetic

Hi Chris,

Look at the cell's Text property instead of the Value property.


--
Hope that helps.

Vergel Adriano


"Chris Wilkinson" wrote:

hi,

I have a cell (G11) whose format is [h]:mm to store hours worked in a week.
I need to use that in a VBA function. If I query G11.value I get a
non-integer number (I DO know that Excel stores time internall like that).
How can I get in a VBA procedure exactly what is see in the cell..e.g if
someone worked 35:15 hours, I want to be able to get 35:15 in the procedure.
I need to strip it from there to work out payment, eg (hourly rate * 35) +
(hourly rate * (15/60)/100).

I have tried using format but it does not like the "[h].mm" argument.

any help is much appreciated.

Chris

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Time arithmetic

Range("G11").Value * 24

will change it to decimal hours

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Chris Wilkinson" wrote in
message ...
hi,

I have a cell (G11) whose format is [h]:mm to store hours worked in a
week.
I need to use that in a VBA function. If I query G11.value I get a
non-integer number (I DO know that Excel stores time internall like that).
How can I get in a VBA procedure exactly what is see in the cell..e.g if
someone worked 35:15 hours, I want to be able to get 35:15 in the
procedure.
I need to strip it from there to work out payment, eg (hourly rate * 35) +
(hourly rate * (15/60)/100).

I have tried using format but it does not like the "[h].mm" argument.

any help is much appreciated.

Chris



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Time arithmetic

If you want to get the "as seen" value in G11:

Sub as_seen()
v = Range("G11").Text
MsgBox (v)
End Sub
--
Gary''s Student - gsnu200715


"Chris Wilkinson" wrote:

hi,

I have a cell (G11) whose format is [h]:mm to store hours worked in a week.
I need to use that in a VBA function. If I query G11.value I get a
non-integer number (I DO know that Excel stores time internall like that).
How can I get in a VBA procedure exactly what is see in the cell..e.g if
someone worked 35:15 hours, I want to be able to get 35:15 in the procedure.
I need to strip it from there to work out payment, eg (hourly rate * 35) +
(hourly rate * (15/60)/100).

I have tried using format but it does not like the "[h].mm" argument.

any help is much appreciated.

Chris

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date arithmetic Terry Pinnell Excel Discussion (Misc queries) 6 December 31st 08 02:53 PM
Is arithmetic on time data possible in Excel 2002? sleeplessinnewjersey Excel Discussion (Misc queries) 1 April 26th 07 06:12 PM
Modular Arithmetic sirsoto Excel Programming 0 August 8th 06 01:11 AM
bad arithmetic pod Excel Programming 1 February 11th 05 04:39 PM
Simple arithmetic - take 2 Pat Excel Discussion (Misc queries) 1 January 24th 05 08:15 PM


All times are GMT +1. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"