Skip to content

Square-bracketed identifiers break the resolver #953

@ThunderFrame

Description

@ThunderFrame

I haven't tried parsing this, but it might be nasty...

Option Explicit

Sub test()

  Dim s As String
  Dim i As Integer
  Dim rng As Range
  Dim a As Variant
  Dim v As Variant

  'Cell address B2
  s = [B2].Address
  s = [$B2].Address
  s = [$B$2].Address
  s = [B$2].Address

  'multi-cell
  s = [B:B].Address
  s = [B2:B4].Address

  'Cell address that can't be old Excel
  s = [XFD1048576]

  'Function name that could be a cell address
  s = E1

  'Function name that can't be a cell address
  s = [EEEE1]

'Excel formulas...
  s = [=TODAY()]
  s = [=B1 + B2]
  s = [=B1 & B2]
  v = [=And(true,true)]


  'Union operators
  s = [B1,B2,B3].Address
  s = [B1, B2, B3].Address

  'Intersection operators
  s = [B:B 2:2 B:C].Address

  'Intersection and union operators
  s = [B:B 2:2 B:C, D1 D:D].Address

  'Named Range
  i = [MyNamedRange].Rows.Count

  'Get range as array
  a = [B2:D4]

  'Get range formulas as array
  a = [B2:B4].Formula

  With [MyNamedRange]
    Set rng = .Cells
  End With

  Set rng = [MyNamedRange]
  Set rng = Sheet1.[MyNamedRange]
  Set rng = [Sheet1].[MyNamedRange]
  Set rng = [Sheet1!MyNamedRange]

End Sub

Public Function E1() As String
  E1 = [F1]
End Function

Public Function EEEE1() As String
  EEEE1 = "Test"
End Function

Metadata

Metadata

Assignees

Labels

bugIdentifies work items for known bugsparse-tree-processingstatus-deferredThere is no way to implement this right now, but the team wants to do it.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions