ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba dim statement with equals (https://www.excelbanter.com/excel-programming/411951-vba-dim-statement-equals.html)

[email protected]

vba dim statement with equals
 
Is there a way to combine a dim statement with setting the initial
value?

ex. dim intvalue=5 as integer


NateBuckley

vba dim statement with equals
 
I could be wrong, and it'd be interesting if someone were to tell me
different, but I'm 85 percent sure you can't do that.

Constants are declared with an initial value, but that's because they're
constants.

" wrote:

Is there a way to combine a dim statement with setting the initial
value?

ex. dim intvalue=5 as integer



Jim Cone[_2_]

vba dim statement with equals
 

You can use a constant...
Const intValue As Integer = 5
However, you will then not be allowed to change it while code is running.
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



wrote in message
Is there a way to combine a dim statement with setting the initial
value?
ex. dim intvalue=5 as integer



All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com