title: Excel gives error when saving macro enabled file
body: <p>I'm very new to vba and a lot of the below code was found online.</p>
  <pre><code>Option Compare Text
  
  Private Sub Worksheet_Change(ByVal Target As Range)
  
      Dim rngCell     As Range
      Dim rngRange    As Range
      Dim strLookFor  As String
      Dim arrChar     As Variant
      Dim lngCounter  As Long
      
      
      Set activeTable = ActiveSheet.ListObjects(&quot;Table1&quot;)
      
     
      activeTable.Range.AutoFilter Field:=10, Criteria1:=&quot;*&quot; &amp; [J3] &amp; &quot;*&quot;, Operator:=xlFilterValues
      Set rRng = ActiveSheet.Range(&quot;J3&quot;)
      
      If IsEmpty(rRng.Value) Then
          activeTable.AutoFilter.ShowAllData
          activeTable.ListColumns(10).Range.Font.Color = vbBlack
      Else
          Call Highlight_words
      End If
      
  End Sub
  
  
  Private Sub Highlight_words()
      
      
      Set rngRange = Range(&quot;J7:J&quot; &amp; Cells(Rows.Count, &quot;J&quot;).End(xlUp).Row).SpecialCells(xlCellTypeVisible)
      rngRange.Font.Color = vbBlue
      strLookFor = Range(&quot;J3&quot;).Value
      
      Application.EnableEvents = False
  
      For Each rngCell In rngRange
          For lngCounter = 1 To Len(rngCell) - Len(strLookFor) + 1
              If Mid(rngCell, lngCounter, Len(strLookFor)) = strLookFor Then
                  rngCell.Characters(lngCounter, Len(strLookFor)).Font.Color = vbRed
              End If
          Next lngCounter
      Next rngCell
  
      Application.EnableEvents = True
      
  End Sub
  </code></pre>
  <p>While the code seems to work in my worksheet, every time I try to save it in &quot;desktop&gt;filename&quot;(as XLSM file) it gives me the following error:</p>
  <p><em>Errors were detected while saving 'file name'. Microsoft excel may be able to save the file by removing or repairing some features. To make the repairs in a new file, click Continue. To cancel saving the file, click Cancel.</em></p>
  <p>I noticed that it only gives me the error if I unhide the for loop. So I'm wondering what's wrong with the for loop?</p>