How to convert 24 hrs in a format, where i can use it to divide,mulitply etc in VBA ?

S

sorabh

Hi guyz
i have value in NettHours which is a date type.
NettHours = Resolve date - Create date

Now i need to calculate how much is NettHours a percent of
say 24 hours.

how to write: PercentageH = NettHours/ 24

i tried this....

PercentageH =
NettHours/formatdatetime("24:00:00",vbgeneraldate)

will this work.... i havent F5 this yet...
any better ideas on how to manipulate date in VBA
will Clng help.. if yes Clng what ? is it Clng(cdate(24:00:00) ????
help:
 
B

Bob Phillips

Just format the NetHours cell as percentage - job done!

CLng casts to long, CDate casts to date. What are you trying to do in VBA?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
S

sorabh

The values NettHours etc are within the Editor... so i want to know i
there is anyway of manipulating dates within the editor befor
outputting it to the sheet.
so the question stands "how to convert 24 hrs in a format in which
can multiply divide it with other "date values"( which internally are
float value.... so bascially ............ well ofcourse why not if the
are float values... i think if i treat 24 hours as 1.0
then i can manipulate it right.
i think i got it.... but still.. all u guyz do advise
plzzzzzzzzzzzzzzzz
regard
 
B

Bob Phillips

Exactly. time is a fraction of 1 day, so it is implicitly a percentage, it
just needs to be multiplied by 100 to see it in a classical percentage view.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Top