When I try to run some simple code (reproduced below), with a global
variable declaration I get the following errror:
Compile Error:
"Invalid Attribute or Sub in function"
And the word Global is highlighted.
It won't work with Public either, only Dim.
I'm using Excel 2007.
Any idea what I'm doing wrong?
Sample Code:
Sub DoThis()
Global strName As String
strName = Range("A1").Address
DoThat
End Sub
Function DoThat()
MsgBox "Name: " & strName
End Function