excelvbavbe

Value "AJ" cannot be assigned to a variable


I am assigning a variable to a function and it works for all values except one.

I put the value, to test the remaining code.

Dim campaignGoal As String: campaignGoal = "AJ"

This code doesn't produce any assignment.

I restarted my computer. It happens only with the value "AJ".

Sub main()
    Dim asdf As String
    asdf = "AJ"
End Sub

What I am executing.
enter image description here

In the End Sub line the asdf = "BK" is already executed.
enter image description here

EDIT: Here you can see a comparison of tooltips and local window as Mathieu pointed out. Use the latter so that you will not struggle as happened to me.
enter image description here


Solution

  • Looks like a debugger glitch (can't repro). The locals toolwindow isn't perfect either, but I suspect it might more reliably show the correct value - which definitely is correctly assigned.

    Prefer using the locals toolwindow (View > Locals) instead of tooltips.