Setting value to variable in VBA from variable in project

Setting value to variable in VBA from variable in project

Hi,
In this sub I am trying to get w to get the value 3 (from u). First I assigning a variable in the project to the value 3 from u. Then I am setting the variable w to the value of the variable in the project. This works except for the last line. What is wrong?

Sub LocalPrice()
Dim u As Double
Dim w As Double
u = 3
thisProject.Variables.Item("Spotpris3[1]").Value = u
w = thisProject.Variables.Item("Spotpris3[1]").Value
End Sub
I also wonder if I can "add watch" when debugging to a variable in the project? How do I do that?
Best,
Jonas

This is a migrated post! Originally posted on 06.02.2015 by user jonastj. Please be aware that information can be outdated.