title: Get a worksheet name using Excel VBA
body: <p>I would like to create an <code>user-defined</code> function in <code>Excel</code> that can return the current worksheet.  I could use the </p>
  
  <pre><code>sheetname = ActiveSheet.Name
  </code></pre>
  
  <p>But the problem with this is, it works and suddenly it starts to get different sheet name. For example, instead of <code>SHEET I LOVE YOU</code> it returns <code>SHEET I HATE YOU</code>. </p>
  
  <p>Is there anyway to fix this - or it might possible because I think it can not be static but varies?</p>