I feel foolish for asking and I'm sure there's a simple answer. I'm trying to get a power for a number as follows:
Sub test()
Dim number As Long
number = 2^8 ' Expect to get 256 here
End Sub
This produces an error: 'Expected: list separator or )'.
I'm surprised this doesn't work. I'm aware that there's an Excel defined power function. But is the ^ operator not supported in VBA - it is in VB6?
FURTHER INFO
If I do the same in the Immediate window, I get the following strangeness (no error):
?2^8
2 8
It looks like just spaces between the 2 and the 8.
IT WORKS?
So I was messing about with various combinations of symbols and found that in the Immediate window:
?2^^8
256
What the...? Anyone know why this might be?
MORE EXPERIMENTS
I'm guessing my installation of Excel must be broken (although absolutely everything else works fine). Some further things the Immediate window:
If I insert a space before ^:
?2 ^3
8
?2!^3
8
?2"^3
2 ^3
?2£^3
2 0 3
?2%^3
8
?2@^3
8
?2#^3
8