ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   My (old) function that I wrote doesn't work anymore! (https://www.excelbanter.com/excel-programming/272734-my-old-function-i-wrote-doesnt-work-anymore.html)

Jimmy

My (old) function that I wrote doesn't work anymore!
 
Hi,

I wrote this a few years back for a time tracking sheet I made. I
wanted to use it again and fired it up but.... it's not working in
excel-xp. The function shows that it requires no arguments now, even
though it should require 4. Any help would be appreciated.

here is the snippet: note some lines wrapped....

Option Explicit
Public Function Calcdowntime(ByVal downdate As Long, downtime As Long,
update As Long, uptime As Long) As Long
Dim dd As Long
Dim dt As Long
Dim ud As Long
Dim ut As Long
Dim dm As Long
Dim um As Long
Dim dh As Long
Dim uh As Long
Dim dttm As Long
Dim utfm As Long
Dim days As Long
days = update - downdate
dm = downtime Mod 100
um = uptime Mod 100
dh = Int(downtime / 100)
uh = Int(uptime / 100)
dttm = ((24 - dh) * 60) - dm
utfm = (uh * 60) + um
Calcdowntime = (dttm + utfm) + ((days - 1) * 1440)
End Function

If you have any ideas - please let me know.

Thanks

Jimmy

Patrick Molloy[_4_]

My (old) function that I wrote doesn't work anymore!
 
worked exactly as is for me O/SX Pro & excel xp

make sure that you have it in a standard Module, ie NOT in a sheet's code
page nor in a class module.



--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
"Jimmy" <no@no wrote in message ...
Hi,

I wrote this a few years back for a time tracking sheet I made. I
wanted to use it again and fired it up but.... it's not working in
excel-xp. The function shows that it requires no arguments now, even
though it should require 4. Any help would be appreciated.

here is the snippet: note some lines wrapped....

Option Explicit
Public Function Calcdowntime(ByVal downdate As Long, downtime As Long,
update As Long, uptime As Long) As Long
Dim dd As Long
Dim dt As Long
Dim ud As Long
Dim ut As Long
Dim dm As Long
Dim um As Long
Dim dh As Long
Dim uh As Long
Dim dttm As Long
Dim utfm As Long
Dim days As Long
days = update - downdate
dm = downtime Mod 100
um = uptime Mod 100
dh = Int(downtime / 100)
uh = Int(uptime / 100)
dttm = ((24 - dh) * 60) - dm
utfm = (uh * 60) + um
Calcdowntime = (dttm + utfm) + ((days - 1) * 1440)
End Function

If you have any ideas - please let me know.

Thanks

Jimmy





All times are GMT +1. The time now is 03:58 PM.

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