tags:

views:

139

answers:

5
some_integer = 97.45 * 1#

what does this notation mean? what will some_integer = ?

+2  A: 

1# means that 1 is evaluated as a double.

I doubt that would make any difference to that calculation though. The calculation would still give 97.45 if 1 was undecorated and thus treated as an integer. And when the result of the calculation is assigned to the the integer some_integer it will be 97.

Sub Macro1()
    Dim i As Integer
    i = 97.45 * 1#
    MsgBox (i) 'Shows 97
End Sub
Martin Smith
nope i believe you are wrong
I__
+5  A: 

1# means "1 as a double". Of course, if some_integer is an integer, then the non-integer portions of the resulting expression will be truncated to 97 (and thus I am confused what it is doing in this case).

INFO: Type Declaration Character to Data Type Chart (in VBA)

pst
looks like only mikeabyss got this one right
I__
+2  A: 

A # in VB means "of type Double".

So some_integer will be 97.

GSerg
looks like only mikeabyss got this one right
I__
MikeAbyss is only correct if some_integer is declared as a non-integral type. Given it's VBA it's probably not declared at all and so becomes a Variant/Double after assignation, but that just means whoever named some_integer should be fired or at least thoroughly beaten with a bag of soap.
Mike Burton
i will make a note of that. what kind of soap do you recommend>??
I__
@I__ [Cor Soap](http://www.corsilver.com/product_cor_soap.html)
pst
buying 1 bag full right now.
I__
btw please dont call me |__
I__
+5  A: 

some_integer will be 97.45.

It's used to treat 1 as a double rather than any other type. (E.G 1 can be treated as an integer, but in this case we want to treat 1 as a double)

You can think of it as some_integer = 97.45 * 1# as benig the same as some_integer = 97.45 * 1.00

MikeAbyss
+4  A: 
Oorang