title: XLSB Personal Macro file Variable Error
body: <p>Disclaimer: This is not my code. I took a macro from a regular xlsm file and placed it on a xslb file to have it handy for analysis. The macro works correctly in the xlsm, but encounters a variable issue on the xlsb file.</p>
  
  <p><code>ColumnToFormat</code> identifies a specific column. I verified that the column is present within the worksheet on my Locals window.</p>
  
  <p><a href="https://i.stack.imgur.com/rK2VL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rK2VL.png" alt="enter image description here"></a></p>
  
  <p>Main Sub</p>
  
  <pre><code>ColumnToFormat = Application.WorksheetFunction.Match("OR_TR_OLD_BAL", ActiveSheet.Rows(1), False)
  
  Call FormatAmounts
  </code></pre>
  
  <p>When I start running <code>FormatAmounts</code>, however, the variable disappears and Excel throws a RunTime Error 1004; Application Defined or Object Defined Error. When testing the xlsm file, this does not happen. The variable gets passed from the main sub to the helper sub. See <code>FormatAmounts</code> sub below.</p>
  
  <p><a href="https://i.stack.imgur.com/dLOIw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dLOIw.png" alt="enter image description here"></a></p>
  
  <pre><code>Sub FormatAmounts()
  ActiveSheet.Columns(ColumnToFormat).Select
   Selection.TextToColumns Destination:=Range(ActiveSheet.Columns(ColumnToFormat).Address), DataType:= _
          xlDelimited, TextQualifier:=xlNone, ConsecutiveDelimiter:=False, _
          Tab:=False, Semicolon:=False, Comma:=False, Space:=False, Other:= _
          False, FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
  Selection.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"
  End Sub
  </code></pre>