Why does no one use the [A1] notation

M

Michael

Hello, why doesn't anyone use the [A1] notation? It seems easier to
write
[A1].select
than
Range("A1").select

so why do I never see it used, I'm guessing there must be a reason...

Thanks

Michael
 
J

Jan Karel Pieterse

Hi Michael,
Hello, why doesn't anyone use the [A1] notation? It seems easier to
write
[A1].select
than
Range("A1").select

One reason might be that the piece between brackets has to be interpreted
(evaluated) by the compiler before it can be "used". So it is slower.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com
 
P

Peter T

1. Fully "qualifying" rather than "evaluating" saves a lot of work behind
the scenes, ie faster.

2. With Range(sAddress) no need to hardcode

3. You get all the intellisense after typing Range("a1") dot

In the following Range() vs [A1] loops 2.5 x faster for me -

Sub test()
Dim t As Single, i As Long, d As Double
[A1] = 123

For k = 1 To 3
t = Timer
For i = 1 To 100000
If k = 1 Then
x = [A1].Value
ElseIf k = 2 Then
x = [=A1]
Else
x = Range("A1").Value
End If
Next
Debug.Print Timer - t
Next

End Sub

For quickly trying things out I use [A1], but never in completed code.

Regards,
Peter T
 
Top