Time arithmetic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Hi Chris,

Look at the cell's Text property instead of the Value property.
 
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)
 
If you want to get the "as seen" value in G11:

Sub as_seen()
v = Range("G11").Text
MsgBox (v)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top