Syntax error text in VBA

R

R Ormerod

Why are the following lines of code not highlighted (in red) to indicate a syntax error when they are clearly incorrect:

ActiveSheete.Range("A1").Select

ActiveSheet e.Range("A1").Select

But this one is highlighted:

ActiveSheet e .Range("A1").Select
 
B

Bob Phillips

The first two are not incorrect, as the

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

R Ormerod said:
Why are the following lines of code not highlighted (in red) to indicate a
syntax error when they are clearly incorrect:
 
B

Bob Phillips

The first two are not incorrect as VBA is treating them as variables. If you
had Option Explicit set you would see you get a variable undefined error.

The third is the same but you added a syntax error by having a space before
the ., so it highlights in red.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

R Ormerod said:
Why are the following lines of code not highlighted (in red) to indicate a
syntax error when they are clearly incorrect:
 
B

Bob Phillips

It will only return an error when you run it because it is only recognised
as an error when VBA tries to resolve the reference - run time.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top