Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Calculation
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Calculation
In VBA it is TimeSerial:
Range("A1").value = Range("A1").value + timeserial(0,0,10) -- Regards, Tom Ogilvy "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Calculation
Thank you both, that did the trick.
"Tom Ogilvy" wrote in message ... In VBA it is TimeSerial: Range("A1").value = Range("A1").value + timeserial(0,0,10) -- Regards, Tom Ogilvy "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop time - start time calculation | Excel Worksheet Functions | |||
Time calculation (Subraction of Idle Time) | Excel Discussion (Misc queries) | |||
Time calculation | Excel Worksheet Functions | |||
Ignoring Time in a Date Time Calculation | Excel Worksheet Functions | |||
time calculation with military time | Excel Worksheet Functions |