View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Minitman[_4_] Minitman[_4_] is offline
external usenet poster
 
Posts: 273
Default Code Does Not Work

Hey Tom,

The first time I ran with the four boxes all = "". it ran until it got
to box 4. I entered a figure into box 3 (the code formats the boxes
on exiting. Boxes 1. 2 and 3 are $ ###0.00 and box 4 is ##0.00 %) and
ran it again. It still wanted a figure in box 3 (where there now was
one). The code worked on the other 3 boxes when they = "", why not
this box? Here is the code for box 4:

Dim vVal4
...
If IsNumeric(T4.Value) And T4.Value < "" Then
vVal4 = T4.Value
Else
vVal4 = 0
End If


I am confused as to how to make it see that T4 has a valid entry (I
tried - vVal4 = CDbl(T4.Value), but got a 'type mismatch' error). I
could really use your insight.

TIA

-Minitman

On Thu, 16 Dec 2004 08:35:51 -0600, Minitman
wrote:

Hey Tom,

WOW! I didn't know you could do more then one elseif at a time! That
is very good to know - Thanks.

As for the reason for this post, both solutions look good.

Thank you.

-Minitman

On Thu, 16 Dec 2004 08:43:38 -0500, "Tom Ogilvy"
wrote:

Put in checks for those conditions

if tb8.Value = "" then
vVal = 0
elseif tb8.Value = 0 then
vVal = 0
elseif isnumeric(tb8.value) then
vVal = cdbl(tb8.value)
else
vVal = 0
End if

or probably better:

if isnumeric(tb8.Value) and tb8.Value < "" then
vVal = cdbl(tb8.Value)
else
vVal = 0
End if