Time durations in excel and VB

G

Guest

I'm using VBA for excel. A formula in a cell calculates the timespan between
two date/times in minutes. I need to extract this number from excel into VB,
but it always converts the number to the date/time serial number! any help
appreciated - this should be easy!
 
B

Bob Phillips

Time is held in Excel as a fractional part of 1 day. So if you declare a
variable as Double, you should be able to get it quite easily as a number

Dim myNum As Double
myNum = Range("D1").Value
MsgBox myNum


--

HTH

RP
(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