tobediff
New Member
A question - I have traditionally used the following method for referencing named ranges in VBA.
I saw this method employed recently.
Is there any substantial difference between them? The only thing I can come up with is the ability to insert variables into my choice of named range is only possible with the first method.
Example:
This works, but I don't see how you could do it using the square bracket method.
Code:
Sub HeyListen()
Dim navi as String
navi = Range("message").Value
MsgBox navi
End Sub
I saw this method employed recently.
Code:
Sub HeyListen()
Dim navi as String
navi = [message]
MsgBox navi
End Sub
Is there any substantial difference between them? The only thing I can come up with is the ability to insert variables into my choice of named range is only possible with the first method.
Example:
Code:
Sub HeyListen()
Dim navi as String
navi = ""
For i = 1 to 3
navi = navi & Range("message" & i).Value
Next
MsgBox navi
End Sub