Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel VBA Pound and Colon Signs Meaning?

Tags:

excel

vba

I am trying to understand a vba function with the pound and colon symbol interspersed throughout it.

VBA function:

kn = 1#: pn = 1#:  y = 1#

I know the pound sign is used to declare a variable as a double in Excel VBA. However, it does not seem to make any sense in terms of the above line. What does the above function do?

like image 541
Shankar ARUL Avatar asked Oct 04 '11 14:10

Shankar ARUL


1 Answers

The colon (:) is a statement delimiter. It would be equivalent to a new line in VBA, or a semicolon in C (just to quote a random example). It allows you to write several instructions on a single line rather than going to a new line each time.

The pound (#) is a short-hand type specifier that forces your literals to be double, so basically 1# is almost equivalent to 1.0.

like image 196
Romain Avatar answered Sep 28 '22 17:09

Romain