title: Runtime error "9" in VBA[excel] - Subscript out of range
body: <p>I am currently working on a code that takes the date from the user, opens a calendar, sees if the month is present, and if it isn't, creates a worksheet with that month name. </p>
  
  <p>The code looks like this where m_y is a string, and has values such as "January 2014" [the " signs included]:</p>
  
  <pre><code>Sub addmonth(m_y)
    On Error Resume Next
    CalendarWorkbook.Worksheets(m_y).Select
  
    If Err.Number&lt;&gt;0 Then
       'code to add sheet and format it
  </code></pre>
  
  <p>I tried putting it in a With/End With command, I have no Option Explicit in the code. Other methods mentioned in answers such as using the <code>.Range()</code> instead of the <code>.Select</code>; however I had no luck in succeeding.</p>
  
  <p>Any help provided would be appreciated.</p>