![]() |
subtracting two date/time columns to get total time
I've got two columns that have a value of "Now" (the second column is
added later...once someone tabs to it). Once the second one is filled out, I need to subtract the two to get the total time spent. Here is what I attempted to do, but I really have no idea what i'm doing or how to get this: ActiveCell.Offset(0, 1).Formula = "=TIME(HOUR(" & ActiveCell & "), MINUTE(" & ActiveCell & ")) - TIME(HOUR(" & ActiveCell.Offset(0, -1) & "), MINUTE(" & ActiveCell.Offset(0, -1) & ")) Any ideas? |
subtracting two date/time columns to get total time
with Activecell
.Offset(0,1).Value = .Value - .Offset(0,-1).Value .Numberformat = "hh:mm:ss" End With -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Drew" wrote in message oups.com... I've got two columns that have a value of "Now" (the second column is added later...once someone tabs to it). Once the second one is filled out, I need to subtract the two to get the total time spent. Here is what I attempted to do, but I really have no idea what i'm doing or how to get this: ActiveCell.Offset(0, 1).Formula = "=TIME(HOUR(" & ActiveCell & "), MINUTE(" & ActiveCell & ")) - TIME(HOUR(" & ActiveCell.Offset(0, -1) & "), MINUTE(" & ActiveCell.Offset(0, -1) & ")) Any ideas? |
subtracting two date/time columns to get total time
the numberformat did it. thanks for your help!
Bob Phillips wrote: with Activecell .Offset(0,1).Value = .Value - .Offset(0,-1).Value .Numberformat = "hh:mm:ss" End With -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Drew" wrote in message oups.com... I've got two columns that have a value of "Now" (the second column is added later...once someone tabs to it). Once the second one is filled out, I need to subtract the two to get the total time spent. Here is what I attempted to do, but I really have no idea what i'm doing or how to get this: ActiveCell.Offset(0, 1).Formula = "=TIME(HOUR(" & ActiveCell & "), MINUTE(" & ActiveCell & ")) - TIME(HOUR(" & ActiveCell.Offset(0, -1) & "), MINUTE(" & ActiveCell.Offset(0, -1) & ")) Any ideas? |
All times are GMT +1. The time now is 02:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com