View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Type Mismatch Help

I'd check the value to make sure that they are both numeric:

if isnumeric(me.textbox1.value) _
and isnumeric(me.textbox2.value) then
me.ttltime2.value = me.textbox2.value - me.textbox1.value
else
me.ttltime2.value = "Non-numerics in textbox1 or textbox2"
end if



WLMPilot wrote:

I have a userform with textbox1 and textbox2. The input into each is time as
hh:mm. I need to subtract the two. However I get a type mismatch for the
following formula:

ttltime2 = textbox2 - textbox1

ttltime2 is DIM as Double.

How do I correct this?

Another question I have is this: Is there a way to format the above
textboxes to
hh:mm so that I can enter 0823 and have it accepted as 08:23?

Thanks,
Les


--

Dave Peterson