gonzal13
asked on
specifying decimal places in code
dim A as as currency
dim b as currency
b = 15 'note: this value can change
A= 2.5 * b
This ends in B = 30 which is not correct.
dim b as currency
b = 15 'note: this value can change
A= 2.5 * b
This ends in B = 30 which is not correct.
b is still same as 15 either...
>dim A as as currency
You have two 'as' here, should only be one.
You have two 'as' here, should only be one.
I get 37.5 as well. There is no way you should be getting anything different, if this code block is correct.
ASKER
dim A as as currency
dim b as currency
b = 15 'note: this value can change
A= 2.5 * b
This ends in A = 30 which is not correct.
Here is the exact code.
Dim BETBJ As Currency
Betone = 15
If NETLow10 <= NetRnge1 And (E = 1 And F = 10) Or (E = 10 And F = 1) _
Then BETBJ = 2.5 * BETONE
Betbj = 30 !
dim b as currency
b = 15 'note: this value can change
A= 2.5 * b
This ends in A = 30 which is not correct.
Here is the exact code.
Dim BETBJ As Currency
Betone = 15
If NETLow10 <= NetRnge1 And (E = 1 And F = 10) Or (E = 10 And F = 1) _
Then BETBJ = 2.5 * BETONE
Betbj = 30 !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
check the value of BETONE
you can add debug.print to debug the variables value, like:
Dim BETBJ As Currency
Betone = 15
If NETLow10 <= NetRnge1 And (E = 1 And F = 10) Or (E = 10 And F = 1) Then
debug.print "BETONE = " & BETONE
BETBJ = 2.5 * BETONE
debug.print "BETBJ = " & BETBJ
end if
just guess that BETONE equals to 12 (which is 30 / 2.5) ...
you can add debug.print to debug the variables value, like:
Dim BETBJ As Currency
Betone = 15
If NETLow10 <= NetRnge1 And (E = 1 And F = 10) Or (E = 10 And F = 1) Then
debug.print "BETONE = " & BETONE
BETBJ = 2.5 * BETONE
debug.print "BETBJ = " & BETBJ
end if
just guess that BETONE equals to 12 (which is 30 / 2.5) ...
ASKER
I guess the scope has changed.
I have tried various senarios listed below and they do not make any sence.
CONST BJ AS CURRENCY =2
BETTHREE IS A VARIABLE AND IN THIS CASE 15
Using debug:
Bet1 = 2.5 * BETTHREE
Bet1 = 30 and BETTHREE = 15
Bet1 = 2 * BETTHREE
Bet1 = 30 and BETTHREE = 15
Now see THIS!
Bet1 = 1 * BETTHREE
Bet1 = 30 and BETTHREE = 15 No I am not on methaphedamines!
Bet1 = BETTHREE
Bet1 = 30 and BETTHREE = 15
Bet1 = 3 * BETTHREE
If NETLow10 > NetRnge2 And (E = 1 And V(5) = 10) Or (E = 1 And V(5) = 1) Then _
Bet1 = 30 and BETTHREE = 15
Bet1 = BETTHREE + BETTHREE + 7.5 Where betthree = 15 Bet1 = 30
Sometimes when I run a module I will get the following comment “ Compile error: End IF without block IF. I do not have an End IF senario.
I would have to rewrite the multitude of if statements with IF … Then End IF but the ElseIF does not fit.
The module consists of many IF statements
I have tried various senarios listed below and they do not make any sence.
CONST BJ AS CURRENCY =2
BETTHREE IS A VARIABLE AND IN THIS CASE 15
Using debug:
Bet1 = 2.5 * BETTHREE
Bet1 = 30 and BETTHREE = 15
Bet1 = 2 * BETTHREE
Bet1 = 30 and BETTHREE = 15
Now see THIS!
Bet1 = 1 * BETTHREE
Bet1 = 30 and BETTHREE = 15 No I am not on methaphedamines!
Bet1 = BETTHREE
Bet1 = 30 and BETTHREE = 15
Bet1 = 3 * BETTHREE
If NETLow10 > NetRnge2 And (E = 1 And V(5) = 10) Or (E = 1 And V(5) = 1) Then _
Bet1 = 30 and BETTHREE = 15
Bet1 = BETTHREE + BETTHREE + 7.5 Where betthree = 15 Bet1 = 30
Sometimes when I run a module I will get the following comment “ Compile error: End IF without block IF. I do not have an End IF senario.
I would have to rewrite the multitude of if statements with IF … Then End IF but the ElseIF does not fit.
The module consists of many IF statements
ASKER
Ok, slightly embarasssed, I found the problem in another portion of the code.
Last item is to designate two decimal places.
Joe
Last item is to designate two decimal places.
Joe
Dim A As Currency
Dim b As Currency
b = 15 'note: this value can change
A = 2.5 * b
MsgBox A
End Sub
i got 37.5 not 30....