title: VBA - Expected identifier or bracketed expression error when using With command
body: <p>I am trying to figure out an problem for class where the idea is to "shorten" the code using the With command. Below is the code I have so far. I am curious why you cannot use the shtThisSheet variable under the with command when there is a parenthesis directly after the .</p>
  
  <p>Thanks all!</p>
  
  <pre><code>Option Explicit
  
  Sub Formatting()
  Dim shtThisSheet As Worksheet
  Set shtThisSheet = ActiveWorkbook.Worksheets("Sheet1").Range
  
  
  With shtThisSheet
  
      .Font.Bold = True
      .Font.Size = 14
      .HorizontalAlignment = xlLeft
      . ("A3:A6").Font.Bold = True
      .("A3:A6").Font.Italic = True
      .("A3:A6").Font.ColorIndex = 5
      .Range("A3:A6").InsertIndent 1
      .Range("B2:D2").Font.Bold = True
      .Range("B2:D2").Font.Italic = True
      .Range("B2:D2").Font.ColorIndex = 5
      .Range("B2:D2").HorizontalAlignment = xlRight
      .Range("B3:D6").Font.ColorIndex = 3
      .Range("B3:D6").NumberFormat = "$#,##0"
  
  End With
  End Sub
  </code></pre>