views:

276

answers:

2

I need to assign a number value to a variable in VBA.

I did this:

var num as integer
num=1

but when I put a breakpoint at num=1 and see the value of num it's showing 0 (zero).

Please help.

+8  A: 

The breakpoint stops on the current instruction without executing it. Try stepping over it and see if the value changes.

codekaizen
+5  A: 

Forgive me if my VBA is a little rusty,
but shouldn't you be using Dim to declare your variables?

Dim num as Integer

num = 1

And you could also try printing the variable's value to the "Immediate window":

Debug.print num
Adam Bernier