title: Call a VBA sub using a string value
body: <p>This is my test code</p>
  
  <pre><code>Sub dotask()
  
      Dim qusub As String
      qusub = Worksheets("Task List").Range("C2").Value
  
      MsgBox qusub
      Application.Run qusub
  
  End Sub
  
  Sub msg1()
  
      MsgBox "sub msg1"
  
  End Sub
  
  Sub msg2()
  
      MsgBox "sub msg2"
  
  End Sub
  
  Sub msg3()
  
      MsgBox "sub msg3"
  
  End Sub
  
  Sub msg4()
  
      MsgBox "sub msg4"
  
  End Sub
  </code></pre>
  
  <p>All of this is contained in a single standard module. I've read <a href="https://stackoverflow.com/questions/15969796/trying-to-call-a-sub-with-a-string-vba">Trying to call a Sub with a String - VBA</a> and wrote my code according to what I found there (i.e. using Application.Run). Cell C2 of Task List worksheet contains "msg3" at the moment. When I execute sub "dotask" I first get a message box saying "msg3" as I want but then I get the following error message:</p>
  
  <blockquote>
    <p>Run-time error '1004':</p>
    
    <p>Cannot run the macro 'msg3'. The macro may not be available in this workbook or all macros may be disabled.</p>
  </blockquote>
  
  <p>I'm working on Excel 2010 and the file is <code>.xlsm</code> - what should I do to get my code to execute as I want it?</p>