View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
George Nicholson[_2_] George Nicholson[_2_] is offline
external usenet poster
 
Posts: 170
Default Time Calculation

Probably because the VBA Time function isn't the same as the Excel Worksheet
function of the same name. Use DateAdd

Range("A1") = DateAdd("s",10, Range("A1"))
or
Range("A1") = Range("A1") + TimeSerial(0, 0, 10)


If that doesn't work then maybe A1 is text rather than numeric:
Range("A1") = DateAdd("s",10, DateValue(Range("A1")))

HTH,

--
George Nicholson

Remove 'Junk' from return address.


"HeartSA" wrote in message
...
Getting a type mismatch error.

I have a cell (A1) with a custom format of mm:ss
I have a macro that is run that should add :10 seconds to the time, but I
am
getting a type mimatch error. Not sure why.
Range("A1").value = Range("A1").value + time(0,0,10)

Please advise.

Thanks,
Doug