title: Looping through all named ranges in excel VBA in current active sheet
body: <p>I am looking to loop through all named ranges found in a <code>activeworksheet</code> and then do something to them. I've used the code below but it does not seem to produce anything. Also, it will be good if I can loop through named ranges that contain certain words. For example, my named ranges are named data1, data2, data3 and so on. I would only like to work on them if they contain the word data.</p>
  <pre><code>For Each nm In Activesheets.Names
      MsgBox &quot;nm.name&quot;
  Next nm
  </code></pre>