A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do i calculate hours/minutes in a billing format.



 
 
Thread Tools Display Modes
  #1  
Old January 12th, 2005, 06:47 PM
msmo
external usenet poster
 
Posts: n/a
Default How do i calculate hours/minutes in a billing format.

I have a template that i downloaded... i need to calculate the hours table so
that it multiplies as hours and minutes...
  #2  
Old January 13th, 2005, 12:37 AM
Doug Robbins
external usenet poster
 
Posts: n/a
Default

This may give you an idea about how to go about it:

' a Macro to calculate the elapsed time for formfields with Date format of
HH:mm

'

Start = ActiveDocument.FormFields("Text1").Result

StartHour = Val(Left(Start, 2))

StartMinutes = Val(Right(Start, 2))

StartTimeMinutes = StartHour * 60 + StartMinutes

Finish = ActiveDocument.FormFields("Text2").Result

FinishHour = Val(Left(Finish, 2))

FinishMinutes = Val(Right(Finish, 2))

FinishTimeMinutes = FinishHour * 60 + FinishMinutes

ElapsedMinutes = FinishTimeMinutes - StartTimeMinutes

ElapsedHours = Int(ElapsedMinutes / 60)

ElapsedMinutes = ElapsedMinutes - ElapsedHours * 60

ActiveDocument.FormFields("Text3").Result = Str(ElapsedHours) & ":" &
Format(ElapsedMinutes, "00")


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"msmo" wrote in message
...
I have a template that i downloaded... i need to calculate the hours table
so
that it multiplies as hours and minutes...



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the Date Format xtian_princess Worksheet Functions 1 September 8th, 2004 02:54 PM
cannot change format of a field DLJ General Discussion 5 August 5th, 2004 09:05 PM
"Format cells" not working v matheson General Discussion 1 July 26th, 2004 06:46 PM
Find/Replace text, NOT format!!! HennyBogan General Discussion 5 June 21st, 2004 08:45 PM
Format will not save! Fred General Discussion 2 June 15th, 2004 06:02 PM


All times are GMT +1. The time now is 12:55 AM.


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