title: Excel VBA Onaction with .Select or .ScrollColumn
body: <p>Good Morning everyone, </p>
  
  <p>I am facing a strange Problem in Excel VBA. </p>
  
  <p>So, I have this minimal Example. The only thing it's supposed to do is, add a Button to the Rightklick context menu. This button should then select a cell. </p>
  
  <p>I searched a bit on StackOverflow and found a solution to passing string arguments in <code>.onaction</code>. But then it gets tricky. I can assign a Range and I can Print the Address and the second Argument in a Mesgbox. But I can't set Breakpoints and even <code>stop</code> doesn't work, nor will <code>.select</code> or <code>.ScrollColumn</code> do anything.</p>
  
  <p>To Replicate just copy the Following code into a standard Module and Execute <code>AddContextmenu</code> to add the Button to the Contextmenu. </p>
  
  <pre><code>Option Explicit
  
  Public Sub AddContextmenu()
  
      Dim MySubMenu As CommandBarControl
      Dim i As Long
  
      'Clear Previous Menu Items
      For Each MySubMenu In Application.CommandBars("Cell").Controls
          If Not MySubMenu.BuiltIn Then
              MySubMenu.Delete
          End If
      Next
  
      'add menu
    AddScrollButtons Application.CommandBars("Cell"), 1
  End Sub
  
  Public Sub AddScrollButtons(ByVal ContextMenu As CommandBar, ByVal baseindex As Long)
      Dim cbb As CommandBarButton
      Dim sFunction As String
  
      'Add Button
      Set cbb = ContextMenu.Controls.Add(Temporary:=True)
      With cbb
  
          sFunction = BuildProcArgString("ScrolltoColTest", "$F$10", "TestArg") ' Get Onaction string
          .OnAction = sFunction
          .Caption = "Scroll Tester"
          .Style = msoButtonAutomatic
      End With
  End Sub
  
  Function BuildProcArgString(ByVal ProcName As String, ParamArray Args() As Variant)
      Dim tempArg As Variant
      Dim temp As String
  
      For Each tempArg In Args
      temp = temp + Chr(34) + tempArg + Chr(34) + ","
      Next
      BuildProcArgString = "'" &amp; ThisWorkbook.Name &amp; "'!" &amp; ProcName + "(" + Left(temp, Len(temp) - 1) + ")" ' (Workbook has to be included to ensure that the sub will be executed in the correct workbook)
  End Function
  
  Public Sub ScrolltoColTest(Addr As String, OtherArg As String)
      Dim cell As Range
      Set cell = ActiveSheet.Range(Addr) 'Get Cell that sould be selected from Addr
  
      MsgBox cell.Address &amp; vbNewLine &amp; OtherArg 'Test if the Arguments have been passed correctly and the cell has been assigned
      Stop 'Why doesn' this stop?
      cell.Select 'Why doesn't this do anything
     ActiveWindow.ScrollColumn = cell.Column 'Why doesn't this do anything
  End Sub
  </code></pre>
  
  <p>As you will see in <code>ScrolltoColTest</code> the Part after the Msgbox will not work at all. 
  Does anyone know why that happens? </p>